mirror of
https://github.com/jazzband/django-authority.git
synced 2026-03-17 06:30:28 +00:00
* refs #1: Updated tox + travis. * refs #1; Fixed path to register. * refs #1: Updated urls.py * refs #1: Added username field. Not really sure why it was needed, but whatever. * Added an update note. * refs #2: Updated travis. * refs #2: Updated command to run tests. * refs #2: Added a test showing permission_required is busted. * refs #2: Custom user modal needs a default manager. * refs #2: Updated settings. * refs #2: Stop the exception from being raised. * refs #2: Fixed a problem with named parameters.
26 lines
770 B
Python
26 lines
770 B
Python
from django.core.urlresolvers import reverse
|
|
from django.test import TestCase
|
|
|
|
from authority.compat import get_user_model
|
|
|
|
|
|
class AddPermissionTestCase(TestCase):
|
|
def test_add_permission_permission_denied_is_403(self):
|
|
user = get_user_model().objects.create(
|
|
username='foo',
|
|
email='foo@example.com',
|
|
)
|
|
user.set_password('pw')
|
|
user.save()
|
|
|
|
assert self.client.login(username='foo@example.com', password='pw')
|
|
url = reverse(
|
|
'authority-add-permission-request',
|
|
kwargs={
|
|
'app_label': 'foo',
|
|
'module_name': 'Bar',
|
|
'pk': 1,
|
|
},
|
|
)
|
|
r = self.client.get(url)
|
|
self.assertEqual(r.status_code, 403)
|