Skip to content

Commit

Permalink
[#1117] Use factory in auth/test_update.py
Browse files Browse the repository at this point in the history
Instead of data.py.
  • Loading branch information
Sean Hammond committed Jul 30, 2013
1 parent eb6fd0a commit c556fab
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ckan/new_tests/logic/auth/test_update.py
Expand Up @@ -2,7 +2,7 @@
'''
import ckan.new_tests.helpers as helpers
import ckan.new_tests.data as data
import ckan.new_tests.factories as factories


class TestUpdate(object):
Expand Down Expand Up @@ -35,7 +35,7 @@ def _call_auth(self, auth_name, context=None, **kwargs):
def test_user_update_visitor_cannot_update_user(self):
'''Visitors should not be able to update users' accounts.'''

user = helpers.call_action('user_create', **data.typical_user())
user = factories.User()
user['name'] = 'updated'

# Try to update the user, but without passing any API key.
Expand All @@ -49,9 +49,8 @@ def test_user_update_visitor_cannot_update_user(self):
def test_user_update_user_cannot_update_another_user(self):
'''Users should not be able to update other users' accounts.'''

fred = helpers.call_action('user_create', **data.typical_user())
bob = helpers.call_action('user_create', name='bob',
email='bob@bob.com', password='pass')
fred = factories.User(name='fred')
bob = factories.User(name='bob')
fred['name'] = 'updated'

# Make Bob try to update Fred's user account.
Expand All @@ -62,7 +61,7 @@ def test_user_update_user_cannot_update_another_user(self):
def test_user_update_user_can_update_herself(self):
'''Users should be authorized to update their own accounts.'''

user = helpers.call_action('user_create', **data.typical_user())
user = factories.User()

context = {'user': user['name']}
user['name'] = 'updated'
Expand Down

0 comments on commit c556fab

Please sign in to comment.