def __init__(self, ctx): super(Quotas, self).__init__(ctx) self.clients = osclients.Clients(self.context["admin"]["endpoint"]) self.manager = { "nova": nova_quotas.NovaQuotas(self.clients), "cinder": cinder_quotas.CinderQuotas(self.clients), "manila": manila_quotas.ManilaQuotas(self.clients), "designate": designate_quotas.DesignateQuotas(self.clients), "neutron": neutron_quotas.NeutronQuotas(self.clients) }
def test_update(self, mock_clients): quotas = designate_quotas.DesignateQuotas(mock_clients) tenant_id = mock.MagicMock() quotas_values = { "domains": 5, "domain_recordsets": 20, "domain_records": 20, "recordset_records": 20, } quotas.update(tenant_id, **quotas_values) mock_clients.designate().quotas.update.assert_called_once_with( tenant_id, quotas_values)
def __init__(self, ctx): super(Quotas, self).__init__(ctx) self.clients = osclients.Clients( self.context["admin"]["credential"], api_info=self.context["config"].get("api_versions")) self.manager = { "nova": nova_quotas.NovaQuotas(self.clients), "cinder": cinder_quotas.CinderQuotas(self.clients), "manila": manila_quotas.ManilaQuotas(self.clients), "designate": designate_quotas.DesignateQuotas(self.clients), "neutron": neutron_quotas.NeutronQuotas(self.clients) }
def test_get(self): tenant_id = "tenant_id" quotas = { "domains": -1, "domain_recordsets": 2, "domain_records": 3, "recordset_records": 3 } clients = mock.MagicMock() clients.designate.return_value.quotas.get.return_value = quotas designate_quo = designate_quotas.DesignateQuotas(clients) self.assertEqual(quotas, designate_quo.get(tenant_id)) clients.designate().quotas.get.assert_called_once_with(tenant_id)
def test_delete(self, mock_clients): quotas = designate_quotas.DesignateQuotas(mock_clients) tenant_id = mock.MagicMock() quotas.delete(tenant_id) mock_clients.designate().quotas.reset.assert_called_once_with( tenant_id)