Skip to content

Commit

Permalink
test autocreated permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Formulka committed Apr 10, 2018
1 parent 6e90f06 commit d0cfa0a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
15 changes: 15 additions & 0 deletions example/dj/apps/issue_tracker/tests/ui_permissions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib.auth.models import User
from django.test import override_settings

from germanium import config
from germanium.annotations import login
Expand Down Expand Up @@ -110,3 +111,17 @@ def test_user_with_permission_may_add_user(self):
'add-is-user-password': 'password'})
assert_http_redirect(resp)
assert_true(User.objects.filter(username=USERNAME).exists())

@override_settings(PERM_AUTO_CREATE=True)
@login(is_superuser=False)
def test_user_with_permission_may_add_user_auto_create_perm(self):
IsCorePerm.objects.all().delete()

self.logged_user.user.perms.add('core.issue_tracker.UserIsCore.create')

USERNAME = 'new_nick'

resp = self.post('%sadd/' % self.USER_UI_URL, data={'add-is-user-username': USERNAME,
'add-is-user-password': 'password'})
assert_http_redirect(resp)
assert_true(User.objects.filter(username=USERNAME).exists())
2 changes: 1 addition & 1 deletion fperms_iscore/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.0'
__version__ = '0.1.1'
Empty file removed fperms_iscore/conf/__init__.py
Empty file.
Empty file removed fperms_iscore/conf/settings.py
Empty file.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
https://github.com/Formulka/django-fperms/tarball/master#egg=django-fperms-0.1.0
https://github.com/Formulka/django-fperms/tarball/0.2.0#egg=django-fperms-0.2.0

https://github.com/druids/germanium/tarball/2.0.3#egg=germanium-2.0.3

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ def get_version(*file_paths):
'Programming Language :: Python :: 3.5',
],
dependency_links=[
'https://github.com/formulka/django-fperms/tarball/master#egg=django-fperms-0.1.0',
'https://github.com/formulka/django-fperms/tarball/0.2.0#egg=django-fperms-0.2.0',
]
)

0 comments on commit d0cfa0a

Please sign in to comment.