def test_update(self):
     clients = mock.MagicMock()
     neutron_quo = neutron_quotas.NeutronQuotas(clients)
     tenant_id = mock.MagicMock()
     neutron_quo.update(tenant_id, **self.quotas)
     body = {"quota": self.quotas}
     clients.neutron().update_quota.assert_called_once_with(tenant_id,
                                                            body=body)
    def test_get(self):
        tenant_id = "tenant_id"
        clients = mock.MagicMock()
        clients.neutron.return_value.show_quota.return_value = {
            "quota": self.quotas
        }
        neutron_quo = neutron_quotas.NeutronQuotas(clients)

        self.assertEqual(self.quotas, neutron_quo.get(tenant_id))
        clients.neutron().show_quota.assert_called_once_with(tenant_id)
Esempio n. 3
0
    def __init__(self, ctx):
        super(Quotas, self).__init__(ctx)
        self.clients = osclients.Clients(self.context["admin"]["credential"])

        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)
        }
        self.original_quotas = []
 def test_delete(self):
     clients = mock.MagicMock()
     neutron_quo = neutron_quotas.NeutronQuotas(clients)
     tenant_id = mock.MagicMock()
     neutron_quo.delete(tenant_id)
     clients.neutron().delete_quota.assert_called_once_with(tenant_id)