Example #1
0
 def test_basic(self):
     sot = quota.Quota()
     self.assertEqual(None, sot.resource_key)
     self.assertEqual('quotas.resources', sot.resources_key)
     self.assertEqual('/quotas/dms', sot.base_path)
     self.assertTrue(sot.allow_list)
     self.assertFalse(sot.allow_create)
     self.assertFalse(sot.allow_get)
     self.assertFalse(sot.allow_update)
     self.assertFalse(sot.allow_delete)
Example #2
0
    def test_list(self):
        sot = quota.Quota()
        mock_response = mock.Mock()
        mock_response.status_code = 200
        mock_response.json.return_value = copy.deepcopy(EXAMPLE_LIST)

        self.sess.get.return_value = mock_response

        result = list(sot.list(self.sess))

        self.sess.get.assert_called_once_with(
            '/quotas/dms',
            headers={'Content-Type': 'application/json'},
            params={})

        expected_list = [
            quota.Quota.existing(**EXAMPLE_LIST['quotas']['resources'][0])
        ]

        self.assertEqual(expected_list, result)
Example #3
0
    def setUp(self):
        super(TestQuota, self).setUp()
        self.sess = mock.Mock(spec=adapter.Adapter)
        self.sess.get = mock.Mock()

        self.sot = quota.Quota()