Пример #1
0
 def test_tenant_absolute_limits_get(self, cc):
     request = self.mock_rest_request(GET={})
     cc.tenant_absolute_limits.return_value = \
         {'id': 'one'}
     response = cinder.TenantAbsoluteLimits().get(request)
     self.assertStatusCode(response, 200)
     self.assertEqual(response.content.decode("utf-8"), '{"id": "one"}')
     cc.tenant_absolute_limits.assert_called_once_with(request)
Пример #2
0
 def test_tenant_absolute_limits_get(self):
     request = self.mock_rest_request(GET={})
     limits = self.cinder_limits['absolute']
     # Ensure to have float(inf) to test it is handled properly
     limits['maxTotalVolumes'] = float('inf')
     self.mock_tenant_absolute_limits.return_value = limits
     response = cinder.TenantAbsoluteLimits().get(request)
     self.assertStatusCode(response, 200)
     self.assertEqual(limits, response.json)
     self.mock_tenant_absolute_limits.assert_called_once_with(request)
 def test_tenant_absolute_limits_get(self, cc):
     request = self.mock_rest_request(GET={})
     cc.tenant_absolute_limits.return_value = \
         {'id': 'one', 'val': float('inf')}
     response = cinder.TenantAbsoluteLimits().get(request)
     self.assertStatusCode(response, 200)
     response_as_json = json.loads(response.content.decode('utf-8'))
     self.assertEqual(response_as_json['id'], 'one')
     self.assertEqual(response_as_json['val'], 1e+999)
     cc.tenant_absolute_limits.assert_called_once_with(request)