Merge "Implement missing mocks to remove error noise during test run"

This commit is contained in:
Jenkins 2014-07-04 16:51:20 +00:00 committed by Gerrit Code Review
commit c3d5e1109f
2 changed files with 16 additions and 5 deletions

View File

@ -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')

View File

@ -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))\