From 893919b04b65c28f952829dada6bc036843d0022 Mon Sep 17 00:00:00 2001 From: Vitor Baptista Date: Tue, 1 Apr 2014 17:09:43 -0300 Subject: [PATCH] [#1505] Test not only the method call, but also that we're returning the value --- ckan/new_tests/logic/auth/test_create.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ckan/new_tests/logic/auth/test_create.py b/ckan/new_tests/logic/auth/test_create.py index 87ddc89ac11..04a05c7fd6a 100644 --- a/ckan/new_tests/logic/auth/test_create.py +++ b/ckan/new_tests/logic/auth/test_create.py @@ -3,6 +3,7 @@ ''' import mock +import nose import ckan.new_tests.helpers as helpers import ckan.new_tests.factories as factories @@ -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)