Skip to content

Commit

Permalink
[#1117] Check error messages in user_update auth tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Aug 2, 2013
1 parent 081e126 commit f61f319
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ckan/new_tests/logic/auth/test_update.py
Expand Up @@ -38,6 +38,10 @@ def test_user_update_visitor_cannot_update_user(self):
result = helpers.call_auth('user_update', context=context, **params)

assert result['success'] is False
# FIXME: This is a terrible error message, containing both 127.0.0.1
# and Fred's user id (not his name).
assert result['msg'] == ('User 127.0.0.1 not authorized to edit user '
'fred_user_id')

def test_user_update_user_cannot_update_another_user(self):
'''Users should not be able to update other users' accounts.'''
Expand Down Expand Up @@ -69,6 +73,9 @@ def test_user_update_user_cannot_update_another_user(self):
result = helpers.call_auth('user_update', context=context, **params)

assert result['success'] is False
# FIXME: This error message should contain Fred's user name not his id.
assert result['msg'] == ('User bob not authorized to edit user '
'fred_user_id')

def test_user_update_user_can_update_herself(self):
'''Users should be authorized to update their own accounts.'''
Expand Down Expand Up @@ -131,5 +138,7 @@ def test_user_update_with_no_user_in_context(self):
result = helpers.call_auth('user_update', context=context, **params)

assert result['success'] is False
# FIXME: Be nice if this error message was a complete sentence.
assert result['msg'] == 'Have to be logged in to edit user'

# TODO: Tests for user_update's reset_key behavior.

0 comments on commit f61f319

Please sign in to comment.