Skip to content

Commit

Permalink
[#1505] Fix tests on Python 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorbaptista authored and amercader committed Jun 19, 2014
1 parent ccd45c0 commit b6dd902
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ckan/new_tests/logic/auth/test_create.py
Expand Up @@ -8,6 +8,8 @@
import ckan.new_tests.helpers as helpers
import ckan.new_tests.factories as factories

logic = helpers.logic


class TestCreate(object):

Expand All @@ -26,11 +28,12 @@ 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']

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

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

gmc.assert_called_twice_with(context, group_member_create_data_dict)

0 comments on commit b6dd902

Please sign in to comment.