Merge "NaNJSONEncoder should be used in api "cinder/tenantabsolutelimits""
This commit is contained in:
commit
2c079f423b
@ -17,6 +17,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from django.views import generic
|
||||
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.api.rest import json_encoder
|
||||
from openstack_dashboard.api.rest import urls
|
||||
from openstack_dashboard.api.rest import utils as rest_utils
|
||||
from openstack_dashboard.usage import quotas
|
||||
@ -308,7 +309,7 @@ class QoSSpecs(generic.View):
|
||||
class TenantAbsoluteLimits(generic.View):
|
||||
url_regex = r'cinder/tenantabsolutelimits/$'
|
||||
|
||||
@rest_utils.ajax()
|
||||
@rest_utils.ajax(json_encoder=json_encoder.NaNJSONEncoder)
|
||||
def get(self, request):
|
||||
return api.cinder.tenant_absolute_limits(request)
|
||||
|
||||
|
@ -292,10 +292,12 @@ class CinderRestTestCase(test.TestCase):
|
||||
def test_tenant_absolute_limits_get(self, cc):
|
||||
request = self.mock_rest_request(GET={})
|
||||
cc.tenant_absolute_limits.return_value = \
|
||||
{'id': 'one'}
|
||||
{'id': 'one', 'val': float('inf')}
|
||||
response = cinder.TenantAbsoluteLimits().get(request)
|
||||
self.assertStatusCode(response, 200)
|
||||
self.assertEqual(response.content.decode("utf-8"), '{"id": "one"}')
|
||||
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)
|
||||
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user