Remove remaining mox usage in tests converted to mock

Some mox dependencies were remaining in the unit tests
converted into mock.

Part of blueprint mock-framework-in-unit-tests
Change-Id: I768c645b8d11fd75dbbcabc7ab8170b6b1074664
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
This commit is contained in:
Akihiro Motoki 2018-03-31 21:00:17 +09:00
parent 7b7ace0aeb
commit 4b304f8b20
3 changed files with 7 additions and 12 deletions

View File

@ -101,7 +101,7 @@ class MigrateHostViewTest(test.BaseAdminViewTests):
if service.binary == 'nova-compute'
and service.status == 'disabled']
disabled_service = disabled_services[0]
self.mox.ReplayAll()
url = reverse('horizon:admin:hypervisors:compute:migrate_host',
args=[disabled_service.host])
res = self.client.get(url)

View File

@ -30,13 +30,13 @@ from openstack_dashboard.test import helpers as test
class MetadataDefinitionsView(test.BaseAdminViewTests):
def test_namespace_object(self):
mock = self.mox.CreateMockAnything()
mock.name = 'hello'
mock.description = 'world'
mock.visibility = 'public'
mock.resource_type_associations = [{'name': 'sample'}]
ns_obj = mock.Mock()
ns_obj.name = 'hello'
ns_obj.description = 'world'
ns_obj.visibility = 'public'
ns_obj.resource_type_associations = [{'name': 'sample'}]
namespace = api.glance.Namespace(mock)
namespace = api.glance.Namespace(ns_obj)
self.assertEqual('world', namespace.description)
self.assertTrue(namespace.public)
self.assertEqual('sample', namespace.resource_type_names[0])
@ -235,7 +235,6 @@ class MetadataDefinitionsCreateViewTest(test.BaseAdminViewTests):
"protected": False,
}
self.mox.ReplayAll()
mock_metadefs_namespace_create.return_value = metadata
form_data = {

View File

@ -924,8 +924,6 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
network = self.networks.first()
self.mock_network_get.side_effect = self.exceptions.neutron
self.mox.ReplayAll()
url = reverse('horizon:project:networks:update', args=[network.id])
res = self.client.get(url)
@ -990,8 +988,6 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
self._stub_net_list()
self.mock_network_delete.return_value = None
self.mox.ReplayAll()
form_data = {'action': 'networks__delete__%s' % network.id}
res = self.client.post(INDEX_URL, form_data)
self.assertRedirectsNoFollow(res, INDEX_URL)