aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_modelmethods.py
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-07-25 18:58:57 +0100
committerJessica Tallon <jessica@megworld.co.uk>2014-07-29 20:29:02 +0100
commit7bfc81b21af65c91dcbd9d33deae2f020d8bbbee (patch)
tree1b9cb32e5f8de29f8356b22cf38547c48c720810 /mediagoblin/tests/test_modelmethods.py
parent97650abd784ba4c2ce902e7d00f7e007479c870f (diff)
downloadmediagoblin-7bfc81b21af65c91dcbd9d33deae2f020d8bbbee.tar.lz
mediagoblin-7bfc81b21af65c91dcbd9d33deae2f020d8bbbee.tar.xz
mediagoblin-7bfc81b21af65c91dcbd9d33deae2f020d8bbbee.zip
Fix #923 - add allow_admin to user_has_privilege decorator
Diffstat (limited to 'mediagoblin/tests/test_modelmethods.py')
-rw-r--r--mediagoblin/tests/test_modelmethods.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/mediagoblin/tests/test_modelmethods.py b/mediagoblin/tests/test_modelmethods.py
index ca436c76..32d5dce0 100644
--- a/mediagoblin/tests/test_modelmethods.py
+++ b/mediagoblin/tests/test_modelmethods.py
@@ -179,20 +179,17 @@ class TestUserHasPrivilege:
self._setup()
# then test out the user.has_privilege method for one privilege
- assert not self.natalie_user.has_privilege(u'commenter')
- assert self.aeva_user.has_privilege(u'active')
+ assert not self.aeva_user.has_privilege(u'admin')
+ assert self.natalie_user.has_privilege(u'active')
-
- def test_user_has_privileges_multiple(self, test_app):
+ def test_allow_admin(self, test_app):
self._setup()
- # when multiple args are passed to has_privilege, the method returns
- # True if the user has ANY of the privileges
- assert self.natalie_user.has_privilege(u'admin',u'commenter')
- assert self.aeva_user.has_privilege(u'moderator',u'active')
- assert not self.natalie_user.has_privilege(u'commenter',u'uploader')
-
+ # This should work because she is an admin.
+ assert self.natalie_user.has_privilege(u'commenter')
+ # Test that we can look this out ignoring that she's an admin
+ assert not self.natalie_user.has_privilege(u'commenter', allow_admin=False)
def test_media_data_init(test_app):
Session.rollback()