From e46fb71c1d7067253f30cb7212c676b066a61432 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Fri, 23 Aug 2013 16:14:36 -0400 Subject: [PATCH] pushing so paroneayea can help me resolve a conflict within the tests. --- mediagoblin/tests/test_modelmethods.py | 28 ++++++++++++-------------- mediagoblin/tests/test_submission.py | 6 +++--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/mediagoblin/tests/test_modelmethods.py b/mediagoblin/tests/test_modelmethods.py index 77d375b7..4af66072 100644 --- a/mediagoblin/tests/test_modelmethods.py +++ b/mediagoblin/tests/test_modelmethods.py @@ -153,16 +153,14 @@ class TestMediaEntrySlugs(object): class TestUserHasPrivilege: def _setup(self): - self.natalie_user = fixture_add_user(u'natalie') - self.aeva_user = fixture_add_user(u'aeva') - self.natalie_user.all_privileges += [ - Privilege.query.filter( - Privilege.privilege_name == u'admin').one(), - Privilege.query.filter( - Privilege.privilege_name == u'moderator').one()] - self.aeva_user.all_privileges += [ - Privilege.query.filter( - Privilege.privilege_name == u'moderator').one()] + fixture_add_user(u'natalie', + privileges=[u'admin',u'moderator',u'active']) + fixture_add_user(u'aeva', + privileges=[u'moderator',u'active']) + self.natalie_user = User.query.filter( + User.username==u'natalie').first() + self.aeva_user = User.query.filter( + User.username==u'aeva').first() def test_privilege_added_correctly(self, test_app): self._setup() @@ -177,8 +175,8 @@ class TestUserHasPrivilege: self._setup() # then test out the user.has_privilege method for one privilege - assert not natalie_user.has_privilege(u'commenter') - assert aeva_user.has_privilege(u'active') + assert not self.natalie_user.has_privilege(u'commenter') + assert self.aeva_user.has_privilege(u'active') def test_user_has_privileges_multiple(self, test_app): @@ -186,9 +184,9 @@ class TestUserHasPrivilege: # when multiple args are passed to has_privilege, the method returns # True if the user has ANY of the privileges - assert natalie_user.has_privilege(u'admin',u'commenter') - assert aeva_user.has_privilege(u'moderator',u'active') - assert not natalie_user.has_privilege(u'commenter',u'uploader') + 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') diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index dbdf87e9..ed088730 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -24,7 +24,7 @@ import pytest from mediagoblin.tests.tools import fixture_add_user from mediagoblin import mg_globals -from mediagoblin.db.models import MediaEntry +from mediagoblin.db.models import MediaEntry, User from mediagoblin.tools import template from mediagoblin.media_types.image import ImageMediaManager from mediagoblin.media_types.pdf.processing import check_prerequisites as pdf_check_prerequisites @@ -46,9 +46,9 @@ class TestSubmission: # TODO: Possibly abstract into a decorator like: # @as_authenticated_user('chris') - test_user = fixture_add_user(privileges=[u'active',u'uploader']) + fixture_add_user(privileges=[u'active',u'uploader']) - self.test_user = test_user + self.test_user = User.query.filter(User.username==u'chris').first() self.login() -- 2.25.1