Skip to content

Commit

Permalink
[#1505] Test not only the method call, but also that we're returning …
Browse files Browse the repository at this point in the history
…the value
  • Loading branch information
vitorbaptista committed Apr 1, 2014
1 parent bce7371 commit 8b21506
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ckan/new_tests/logic/auth/test_create.py
Expand Up @@ -3,6 +3,7 @@
'''

import mock
import nose

import ckan.new_tests.helpers as helpers
import ckan.new_tests.factories as factories
Expand All @@ -25,6 +26,11 @@ def test_user_invite_delegates_correctly_to_group_member_create(self, gmc):
group_member_create_data_dict = data_dict.copy()
group_member_create_data_dict['id'] = data_dict['group_id']

helpers.call_auth('user_invite', context=context, **data_dict)
with nose.tools.assert_raises(helpers.logic.NotAuthorized):
gmc.return_value = {'success': False}
helpers.call_auth('user_invite', context=context, **data_dict)

gmc.assert_called_with(context, group_member_create_data_dict)
gmc.return_value = {'success': True}
assert helpers.call_auth('user_invite', context=context, **data_dict)

gmc.assert_called_twice_with(context, group_member_create_data_dict)

0 comments on commit 8b21506

Please sign in to comment.