Fix unit tests failing caused by new Mock release
Since the mock 1.1.1 calling of function 'assert_called' and 'assert_called_once' raises the AttributeError. In current patchset calling of these functions is fixed Change-Id: I5c21bb3f6cfd8cc095a277ead80794e97bb63c72
This commit is contained in:
@@ -208,8 +208,11 @@ class ClientAuthTest(utils.BaseTestCase):
|
|||||||
client.auth_plugin.opts.pop('token', None)
|
client.auth_plugin.opts.pop('token', None)
|
||||||
client.auth_plugin._do_authenticate(mock.MagicMock())
|
client.auth_plugin._do_authenticate(mock.MagicMock())
|
||||||
|
|
||||||
discover_mock.assert_called(auth_url='http://no.where',
|
self.assertEqual([mock.call(auth_url='http://no.where',
|
||||||
session=mock_session_instance)
|
session=mock_session_instance)],
|
||||||
|
discover_mock.call_args_list)
|
||||||
|
# discover_mock.assert_called(auth_url='http://no.where',
|
||||||
|
# session=mock_session_instance)
|
||||||
self.assertIsInstance(mock_session_instance.auth, v3_auth.Password)
|
self.assertIsInstance(mock_session_instance.auth, v3_auth.Password)
|
||||||
|
|
||||||
@mock.patch('keystoneclient.discover.Discover')
|
@mock.patch('keystoneclient.discover.Discover')
|
||||||
@@ -233,9 +236,10 @@ class ClientAuthTest(utils.BaseTestCase):
|
|||||||
client = self.create_client(env)
|
client = self.create_client(env)
|
||||||
client.auth_plugin.opts.pop('token', None)
|
client.auth_plugin.opts.pop('token', None)
|
||||||
client.auth_plugin._do_authenticate(mock.MagicMock())
|
client.auth_plugin._do_authenticate(mock.MagicMock())
|
||||||
|
self.assertEqual([mock.call(auth_url='http://no.where',
|
||||||
|
session=session_instance_mock)],
|
||||||
|
discover.call_args_list)
|
||||||
|
|
||||||
discover.assert_called(auth_url='http://no.where',
|
|
||||||
session=session_instance_mock)
|
|
||||||
self.assertIsInstance(session_instance_mock.auth, v2_auth.Password)
|
self.assertIsInstance(session_instance_mock.auth, v2_auth.Password)
|
||||||
|
|
||||||
@mock.patch('keystoneclient.discover.Discover')
|
@mock.patch('keystoneclient.discover.Discover')
|
||||||
@@ -260,8 +264,9 @@ class ClientAuthTest(utils.BaseTestCase):
|
|||||||
self.assertRaises(ks_exc.DiscoveryFailure,
|
self.assertRaises(ks_exc.DiscoveryFailure,
|
||||||
client.auth_plugin._do_authenticate,
|
client.auth_plugin._do_authenticate,
|
||||||
mock.Mock())
|
mock.Mock())
|
||||||
discover.assert_called(auth_url='http://no.where',
|
self.assertEqual([mock.call(auth_url='http://no.where',
|
||||||
session=session_instance_mock)
|
session=session_instance_mock)],
|
||||||
|
discover.call_args_list)
|
||||||
|
|
||||||
@mock.patch('keystoneclient.discover.Discover')
|
@mock.patch('keystoneclient.discover.Discover')
|
||||||
@mock.patch('keystoneclient.session.Session')
|
@mock.patch('keystoneclient.session.Session')
|
||||||
|
Reference in New Issue
Block a user