Fix mock issues found due to new mock release

Fix issues that exposed themselves due to the recent mock release

Change-Id: I127c96b8762dcf8dc23ab53aef78a737097d45e9
Closes-Bug: 1473303
This commit is contained in:
lin-hua-cheng 2015-07-10 01:30:16 -07:00
parent 4f39da5b02
commit 244162afe4
2 changed files with 9 additions and 10 deletions

View File

@ -42,7 +42,6 @@ class KeystoneRestTestCase(test.TestCase):
self.assertStatusCode(response, 200)
self.assertEqual(response.content, '{"name": "Ni!"}')
kc.user_get.assert_called_once_with(request, 'current_id')
kc.user_get.assert_not_called()
@mock.patch.object(keystone.api, 'keystone')
def test_user_get_list(self, kc):
@ -151,7 +150,7 @@ class KeystoneRestTestCase(test.TestCase):
response = keystone.Users().delete(request)
self.assertStatusCode(response, 204)
self.assertEqual(response.content, '')
kc.user_delete.assert_has_mock.calls([
kc.user_delete.assert_has_calls([
mock.call(request, 'id1'),
mock.call(request, 'id2'),
mock.call(request, 'id3'),
@ -312,7 +311,7 @@ class KeystoneRestTestCase(test.TestCase):
response = keystone.Roles().delete(request)
self.assertStatusCode(response, 204)
self.assertEqual(response.content, '')
kc.role_delete.assert_has_mock.calls([
kc.role_delete.assert_has_calls([
mock.call(request, 'id1'),
mock.call(request, 'id2'),
mock.call(request, 'id3'),
@ -418,7 +417,7 @@ class KeystoneRestTestCase(test.TestCase):
response = keystone.Domains().delete(request)
self.assertStatusCode(response, 204)
self.assertEqual(response.content, '')
kc.domain_delete.assert_has_mock.calls([
kc.domain_delete.assert_has_calls([
mock.call(request, 'id1'),
mock.call(request, 'id2'),
mock.call(request, 'id3'),
@ -539,7 +538,7 @@ class KeystoneRestTestCase(test.TestCase):
response = keystone.Projects().delete(request)
self.assertStatusCode(response, 204)
self.assertEqual(response.content, '')
kc.tenant_delete.assert_has_mock.calls([
kc.tenant_delete.assert_has_calls([
mock.call(request, 'id1'),
mock.call(request, 'id2'),
mock.call(request, 'id3'),

View File

@ -22,7 +22,7 @@ class RestUtilsTestCase(test.TestCase):
return 'ok'
request = self.mock_rest_request()
response = f(None, request)
request.is_authenticated.assert_called_once()
request.user.is_authenticated.assert_called_once_with()
self.assertStatusCode(response, 200)
self.assertEqual(response.content, '"ok"')
@ -32,7 +32,7 @@ class RestUtilsTestCase(test.TestCase):
return 'ok'
request = self.mock_rest_request()
response = f(None, request)
request.is_authenticated.assert_not_called_once()
request.user.is_authenticated.assert_not_called()
self.assertStatusCode(response, 200)
self.assertEqual(response.content, '"ok"')
@ -44,7 +44,7 @@ class RestUtilsTestCase(test.TestCase):
'user.is_authenticated.return_value': False
})
response = f(None, request)
request.is_authenticated.assert_called_once()
request.user.is_authenticated.assert_called_once_with()
self.assertStatusCode(response, 401)
self.assertEqual(response.content, '"not logged in"')
@ -111,7 +111,7 @@ class RestUtilsTestCase(test.TestCase):
return utils.CreatedResponse('/api/spam/spam123')
request = self.mock_rest_request()
response = f(None, request)
request.is_authenticated.assert_called_once()
request.user.is_authenticated.assert_called_once_with()
self.assertStatusCode(response, 201)
self.assertEqual(response['location'], '/api/spam/spam123')
self.assertEqual(response.content, '')
@ -122,7 +122,7 @@ class RestUtilsTestCase(test.TestCase):
return utils.CreatedResponse('/api/spam/spam123', 'spam!')
request = self.mock_rest_request()
response = f(None, request)
request.is_authenticated.assert_called_once()
request.user.is_authenticated.assert_called_once_with()
self.assertStatusCode(response, 201)
self.assertEqual(response['location'], '/api/spam/spam123')
self.assertEqual(response.content, '"spam!"')