Esempio n. 1
0
    def test_delete(self):
        clients = mock.MagicMock()
        instance = manila_quotas.ManilaQuotas(clients)
        tenant_id = mock.MagicMock()

        instance.delete(tenant_id)

        clients.manila.return_value.quotas.delete.assert_called_once_with(
            tenant_id)
Esempio n. 2
0
    def test_get(self):
        tenant_id = "tenant_id"
        quotas = {"gigabytes": "gb", "snapshots": "ss", "shares": "v",
                  "snapshot_gigabytes": "sg", "share_networks": "sn"}
        quota_set = mock.MagicMock(**quotas)
        clients = mock.MagicMock()
        clients.manila.return_value.quotas.get.return_value = quota_set
        manila_quo = manila_quotas.ManilaQuotas(clients)

        self.assertEqual(quotas, manila_quo.get(tenant_id))
        clients.manila().quotas.get.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 = []
Esempio n. 4
0
    def test_update(self):
        clients = mock.MagicMock()
        instance = manila_quotas.ManilaQuotas(clients)
        tenant_id = mock.MagicMock()
        quotas_values = {
            "shares": 10,
            "gigabytes": 13,
            "snapshots": 7,
            "snapshot_gigabytes": 51,
            "share_networks": 1014,
        }

        instance.update(tenant_id, **quotas_values)

        clients.manila.return_value.quotas.update.assert_called_once_with(
            tenant_id, **quotas_values)