Esempio n. 1
0
 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)
Esempio n. 2
0
    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"]["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)
        }
Esempio n. 4
0
    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)
        }
Esempio n. 5
0
 def test_update(self, mock_clients):
     neutron_quotas = quotas.NeutronQuotas(mock_clients)
     tenant_id = mock.MagicMock()
     quotas_values = {
         "network": 20,
         "subnet": 20,
         "port": 100,
         "router": 20,
         "floatingip": 100,
         "security_group": 100,
         "security_group_rule": 100
     }
     neutron_quotas.update(tenant_id, **quotas_values)
     body = {"quota": quotas_values}
     mock_clients.neutron().update_quota.assert_called_once_with(tenant_id,
                                                                 body=body)
Esempio n. 6
0
 def test_delete(self, mock_clients):
     neutron_quotas = quotas.NeutronQuotas(mock_clients)
     tenant_id = mock.MagicMock()
     neutron_quotas.delete(tenant_id)
     mock_clients.neutron().delete_quota.assert_called_once_with(tenant_id)
Esempio n. 7
0
 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)