diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-07-04 16:51:20 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-07-04 16:51:20 +0000 |
commit | c3d5e1109f1427e30632c1a6fb593e61e4623e86 (patch) | |
tree | 5b211f3e82595891a1ecbd942091fe33a176f078 /openstack_dashboard/dashboards | |
parent | 78165e115c754aab5ea61ea4c0cf97eb6f455b2b (diff) | |
parent | ff6425bf2071e8f8589c450c53ff6f608290d5e1 (diff) | |
download | horizon-c3d5e1109f1427e30632c1a6fb593e61e4623e86.tar.gz |
Merge "Implement missing mocks to remove error noise during test run"
Diffstat (limited to 'openstack_dashboard/dashboards')
-rw-r--r-- | openstack_dashboard/dashboards/admin/info/tests.py | 15 | ||||
-rw-r--r-- | openstack_dashboard/dashboards/project/volumes/volumes/tests.py | 6 |
2 files changed, 16 insertions, 5 deletions
diff --git a/openstack_dashboard/dashboards/admin/info/tests.py b/openstack_dashboard/dashboards/admin/info/tests.py index cf92085d8..6c15a6662 100644 --- a/openstack_dashboard/dashboards/admin/info/tests.py +++ b/openstack_dashboard/dashboards/admin/info/tests.py @@ -28,7 +28,7 @@ class SystemInfoViewTests(test.BaseAdminViewTests): @test.create_stubs({api.base: ('is_service_enabled',), api.nova: ('default_quota_get', 'service_list'), api.neutron: ('agent_list', 'is_extension_supported'), - api.cinder: ('default_quota_get',)}) + api.cinder: ('default_quota_get', 'service_list')}) def test_index(self): services = self.services.list() api.nova.service_list(IsA(http.HttpRequest)).AndReturn(services) @@ -41,8 +41,13 @@ class SystemInfoViewTests(test.BaseAdminViewTests): .MultipleTimes().AndReturn(True) api.nova.default_quota_get(IsA(http.HttpRequest), IgnoreArg()).AndReturn({}) + api.cinder.default_quota_get(IsA(http.HttpRequest), self.tenant.id)\ .AndReturn(self.cinder_quotas.first()) + cinder_services = self.cinder_services.list() + api.cinder.service_list(IsA(http.HttpRequest)).\ + AndReturn(cinder_services) + api.neutron.is_extension_supported(IsA(http.HttpRequest), 'security-group').AndReturn(True) @@ -71,14 +76,17 @@ class SystemInfoViewTests(test.BaseAdminViewTests): network_agents_tab._tables['network_agents'].data, [agent.__repr__() for agent in self.agents.list()] ) + self.mox.VerifyAll() @test.create_stubs({api.base: ('is_service_enabled',), - api.cinder: ('service_list', ), + api.cinder: ('default_quota_get', 'service_list'), api.nova: ('default_quota_get', 'service_list'), api.neutron: ('agent_list', 'is_extension_supported')}) def test_cinder_services_index(self): cinder_services = self.cinder_services.list() api.nova.service_list(IsA(http.HttpRequest)).AndReturn([]) + api.cinder.default_quota_get(IsA(http.HttpRequest), self.tenant.id)\ + .AndReturn(self.cinder_quotas.first()) api.cinder.service_list(IsA(http.HttpRequest)).\ AndReturn(cinder_services) api.neutron.agent_list(IsA(http.HttpRequest)).AndReturn([]) @@ -114,7 +122,7 @@ class SystemInfoViewTests(test.BaseAdminViewTests): @test.create_stubs({api.base: ('is_service_enabled',), api.nova: ('default_quota_get', 'service_list'), - api.cinder: ('default_quota_get',)}) + api.cinder: ('default_quota_get', 'service_list')}) def _test_default_quotas_index(self, neutron_enabled=True, neutron_sg_enabled=True): # Neutron does not have an API for getting default system @@ -130,6 +138,7 @@ class SystemInfoViewTests(test.BaseAdminViewTests): self.tenant.id).AndReturn(self.quotas.nova) api.cinder.default_quota_get(IsA(http.HttpRequest), self.tenant.id)\ .AndReturn(self.cinder_quotas.first()) + api.cinder.service_list(IsA(http.HttpRequest)).AndReturn([]) if neutron_enabled: self.mox.StubOutWithMock(api.neutron, 'agent_list') diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/volumes/tests.py index cdee82127..7b4f73142 100644 --- a/openstack_dashboard/dashboards/project/volumes/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/volumes/tests.py @@ -1040,7 +1040,7 @@ class VolumeViewTests(test.TestCase): def test_encryption_true(self): self._test_encryption(True) - @test.create_stubs({cinder: ('volume_list',), + @test.create_stubs({cinder: ('volume_list', 'volume_snapshot_list'), api.nova: ('server_list',), quotas: ('tenant_quota_usages',)}) def _test_encryption(self, encryption): @@ -1050,7 +1050,9 @@ class VolumeViewTests(test.TestCase): quota_usages = self.quota_usages.first() cinder.volume_list(IsA(http.HttpRequest), search_opts=None)\ - .AndReturn(self.volumes.list()) + .MultipleTimes().AndReturn(self.volumes.list()) + cinder.volume_list(IsA(http.HttpRequest)).AndReturn([]) + cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) api.nova.server_list(IsA(http.HttpRequest), search_opts=None)\ .AndReturn([self.servers.list(), False]) quotas.tenant_quota_usages(IsA(http.HttpRequest))\ |