mirror of
https://github.com/jazzband/django-authority.git
synced 2026-03-17 06:30:28 +00:00
* Updated tox to test only python{2,3}.7 and djagno1.11/2.2
* Updated travis.
* Updated models/migrations.
* Updated path to `reverse`
* Updated path to login view.
* Updated middlewares/installed apps
* Updated .travis again.
* Lets see if that will get tests working in python3 on travis.
* Switch to in memory DB for tests
* Stop running tests with python2.7 and django 2.2. They shouldn't work anyway.
* Sure did that wrong. Fix which python versions are running with which code.
* That isn't needed. Lets see if that is what is breaking python3.
* Testing a theory.
* Revert "Testing a theory."
This reverts commit 69b3e4c906.
* Added initial migration for example users.
* is_authenticated is a bool, not a method.
26 lines
757 B
Python
26 lines
757 B
Python
from django.urls 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)
|