Skip to content

Commit 642c3fa

Browse files
committed
Merge pull request #53 from brack3t/fix/tests
Fix/tests
2 parents cf0ac83 + 6f4cb05 commit 642c3fa

File tree

8 files changed

+72
-67
lines changed

8 files changed

+72
-67
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install:
1111
- "pip install -q django==$DJANGO_VERSION"
1212
- "python setup.py -q install"
1313
- "pip install -r requirements.txt"
14-
script: "py.test tests/ --cov=braces --cov-report=html"
14+
script: "py.test tests/"
1515
matrix:
1616
exclude:
1717
- python: 3.3

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include README.rst
1+
include README.md
22
include LICENSE
33
include CONTRIBUTORS.txt
44
recursive-include braces *.py

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# django-braces
2+
Mixins for Django's class-based views.
3+
4+
[![Latest drone.io status](https://drone.io/github.com/brack3t/django-braces/status.png)](https://drone.io/github.com/brack3t/django-braces)
5+
[![Latest PyPI version](https://pypip.in/v/django-braces/badge.png)](https://crate.io/packages/django-braces/)
6+
[![Number of PyPI downloads](https://pypip.in/d/django-braces/badge.png)](https://crate.io/packages/django-braces/)
7+
8+
## Documentation
9+
[Read The Docs](http://django-braces.readthedocs.org/en/latest/index.html)
10+
11+
## Installation
12+
Install from PyPI with `pip`:
13+
`pip install django-braces`
14+
15+
## Contributing
16+
17+
Fork, make a change, update the docs, add/update tests, make a pull request.
18+
19+
Add yourself to `CONTRIBUTORS.txt` if you want.
20+
21+
All development dependencies are available in `requirements.txt` file.
22+
23+
To run the test suite, execute the following in your shell (Django install is required):
24+
`py.test tests/ --cov=braces --cov-report=html`
25+
26+
## Change Log
27+
28+
29+
### 1.1.0
30+
* `JSONResponseMixin.render_json_response` method updated to accept a status code.
31+
* `JSONResponseMixin` added `json_dumps_kwargs` attribute & get method to pass args to the json encoder.
32+
* New `OrderableListMixin` allows ordering of list views by GET params.
33+
* Tests updated to test against latest stable Django release (1.5.1)
34+
* Small fixes and additions to documentation.
35+
36+
### 1.0.0
37+
* New 'abstract' `AccessMixin` which provides overridable `get_login_url` and `get_redirect_field_name methods` for all access-based mixins.
38+
* Rewritten `LoginRequiredMixin` which provides same customization as other access mixins with `login_url`, `raise_exception` & `redirect_field_name`.
39+
* New `PrefetchRelatedMixin`. Works the same as `SelectRelatedMixin` but uses Django's `prefetch_related` method.
40+
* `CreateAndRedirectToEditView` is marked for deprecation.
41+
* `PermissionRequiredMixin` no longer requires dot syntax for permission names.
42+
* Marked package as supporting 2.6 thru 3.3 (from rafales).
43+
* Fixes to documentation.
44+
* Tests to cover new additions and changes.
45+
46+
### 0.2.3
47+
* Tests for all mixins (from rafales).
48+
* New `CsrfExemptMixin` for marking views as being CSRF exempt (from jarcoal).
49+
* Some documentation updates and a spelling error correction (from shabda).
50+
* `SuccessURLRedirectListMixin` raises `ImproperlyConfigured` if no `success_list_url` attribute is supplied (from kennethlove).
51+
52+
### 0.2.2
53+
* Try importing the built-in json module first, drop back to Django if necessary. Django 1.5 compatibility.
54+
55+
### 0.2.1
56+
* Fixed signature of `UserFormKwargsMixin.get_form_kwargs`
57+
* Updated `JSONResponseMixin` to work with non-ASCII characters and other datatypes (such as datetimes)
58+
* Fixed all mixins that have `raise_exception` as an argument to properly raise a `PermissionDenied` exception to allow for custom 403s.

README.rst

Lines changed: 0 additions & 54 deletions
This file was deleted.

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@
4141

4242
# General information about the project.
4343
project = u'django-braces'
44-
copyright = u'2012, Kenneth Love and Chris Jones'
44+
copyright = u'2013, Kenneth Love and Chris Jones'
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the
4848
# built documents.
4949
#
5050
# The short X.Y version.
51-
version = '1.0.0'
51+
version = '1.1.0'
5252
# The full version, including alpha/beta/rc tags.
53-
release = '1.0.0'
53+
release = '1.1.0'
5454

5555
# The language for content autogenerated by Sphinx. Refer to documentation
5656
# for a list of supported languages.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="django-braces",
5-
version="1.0.0",
5+
version="1.1.0",
66
description="Reusable, generic mixins for Django",
77
long_description="Mixins to add easy functionality to Django class-based views, forms, and models.",
88
keywords="django, views, forms, mixins",

tests/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.contrib.auth.models import AnonymousUser
33

44

5-
class TestViewHelper(test.TestCase):
5+
class TestViewHelper(object):
66
"""
77
Helper class for unit-testing class based views.
88
"""

tests/test_access_mixins.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,21 @@ def test_get_login_url_raises_exception(self):
8282
ImproperlyConfigured.
8383
"""
8484
with self.assertRaises(ImproperlyConfigured):
85-
self.dispatch_view(self.build_request(path=self.view_url),
86-
login_url=None)
85+
self.dispatch_view(
86+
self.build_request(path=self.view_url), login_url=None)
8787

8888
def test_get_redirect_field_name_raises_exception(self):
8989
"""
9090
Test that get_redirect_field_name from AccessMixin raises
9191
ImproperlyConfigured.
9292
"""
9393
with self.assertRaises(ImproperlyConfigured):
94-
self.dispatch_view(self.build_request(path=self.view_url),
94+
self.dispatch_view(
95+
self.build_request(path=self.view_url),
9596
redirect_field_name=None)
9697

9798

98-
class TestLoginRequiredMixin(TestViewHelper):
99+
class TestLoginRequiredMixin(TestViewHelper, test.TestCase):
99100
"""
100101
Tests for LoginRequiredMixin.
101102
"""
@@ -108,8 +109,8 @@ def test_anonymous(self):
108109

109110
def test_anonymous_raises_exception(self):
110111
with self.assertRaises(PermissionDenied):
111-
self.dispatch_view(self.build_request(path=self.view_url),
112-
raise_exception=True)
112+
self.dispatch_view(
113+
self.build_request(path=self.view_url), raise_exception=True)
113114

114115
def test_authenticated(self):
115116
user = make_user()

0 commit comments

Comments
 (0)