def prepare_action_context(self, request, context): try: quotas = api_manila.tenant_quota_get(request, context['project_id']) for field in api_manila.MANILA_QUOTA_FIELDS: # Resolve mismatch UI field names and data field names. data_field = api_manila.MANILA_QUOTA_FIELDS_DATA_MAP[field] context[field] = quotas.get(data_field).limit except Exception as ex: LOG.exception(ex) exceptions.handle(request, _('Unable to retrieve share quotas.')) return context
def test_tenant_quota_get(self): tenant_id = 'fake_tenant_id' result = api.tenant_quota_get(self.request, tenant_id) self.assertIsNotNone(result) self.manilaclient.quotas.get.assert_called_once_with(tenant_id)
def test_default_quota_get(self): project_id = 'fake_project_id' api.tenant_quota_get(self.request, project_id) self.manilaclient.quotas.get.assert_called_once_with(project_id)