def setUp(self): super(TestQuotaShow, self).setUp() self.quotas_mock.get.return_value = FakeQuotaResource( None, copy.deepcopy(compute_fakes.QUOTA), loaded=True, ) self.quotas_mock.defaults.return_value = FakeQuotaResource( None, copy.deepcopy(compute_fakes.QUOTA), loaded=True, ) self.volume_quotas_mock.get.return_value = FakeQuotaResource( None, copy.deepcopy(compute_fakes.QUOTA), loaded=True, ) self.volume_quotas_mock.defaults.return_value = FakeQuotaResource( None, copy.deepcopy(compute_fakes.QUOTA), loaded=True, ) self.service_catalog_mock.get_endpoints.return_value = [ fakes.FakeResource( None, copy.deepcopy(identity_fakes.ENDPOINT), loaded=True, ) ] self.quotas_class_mock.get.return_value = FakeQuotaResource( None, copy.deepcopy(compute_fakes.QUOTA), loaded=True, ) self.volume_quotas_class_mock.get.return_value = FakeQuotaResource( None, copy.deepcopy(compute_fakes.QUOTA), loaded=True, ) self.projects_mock.get.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes.PROJECT), loaded=True, ) self.app.client_manager.network = network_fakes.FakeNetworkV2Client( endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN, ) self.cmd = quota.ShowQuota(self.app, None)
def setUp(self): super(TestQuotaShow, self).setUp() self.compute_quota = compute_fakes.FakeQuota.create_one_comp_quota() self.compute_quotas_mock.get.return_value = self.compute_quota self.compute_default_quota = \ compute_fakes.FakeQuota.create_one_default_comp_quota() self.compute_quotas_mock.defaults.return_value = \ self.compute_default_quota self.compute_quotas_class_mock.get.return_value = FakeQuotaResource( None, copy.deepcopy(compute_fakes.QUOTA), loaded=True, ) self.volume_quota = volume_fakes.FakeQuota.create_one_vol_quota() self.volume_quotas_mock.get.return_value = self.volume_quota self.volume_default_quota = \ volume_fakes.FakeQuota.create_one_default_vol_quota() self.volume_quotas_mock.defaults.return_value = \ self.volume_default_quota self.volume_quotas_class_mock.get.return_value = FakeQuotaResource( None, copy.deepcopy(volume_fakes.QUOTA), loaded=True, ) fake_network_endpoint = fakes.FakeResource( None, copy.deepcopy(identity_fakes.ENDPOINT), loaded=True, ) self.service_catalog_mock.get_endpoints.return_value = { 'network': fake_network_endpoint } self.app.client_manager.network = network_fakes.FakeNetworkV2Client( endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN, ) self.network = self.app.client_manager.network self.network.get_quota = mock.Mock( return_value=network_fakes.QUOTA, ) self.network.get_quota_default = mock.Mock( return_value=network_fakes.QUOTA, ) self.cmd = quota.ShowQuota(self.app, None)