diff options
| author | Lukas Hetzenecker <lukas@splots.co> | 2015-06-23 22:56:22 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-06-24 18:41:25 +0200 |
| commit | 6355a6d4f59eb220e05130d179beba7bb29c88af (patch) | |
| tree | 2dfe2741a131947efc91ae93a34b2cfe208ad461 /tests/httpwrappers | |
| parent | c078021555dcda6b12363b5b0646eac5332a0d86 (diff) | |
Fixed #25019 -- Added UUID support in DjangoJSONEncoder
Diffstat (limited to 'tests/httpwrappers')
| -rw-r--r-- | tests/httpwrappers/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index 3f641da89b..84d65ad801 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -6,6 +6,7 @@ import json import os import pickle import unittest +import uuid from django.core.exceptions import SuspiciousOperation from django.core.serializers.json import DjangoJSONEncoder @@ -480,6 +481,11 @@ class JsonResponseTests(SimpleTestCase): response = JsonResponse(['foo', 'bar'], safe=False) self.assertEqual(json.loads(response.content.decode()), ['foo', 'bar']) + def test_json_response_uuid(self): + u = uuid.uuid4() + response = JsonResponse(u, safe=False) + self.assertEqual(json.loads(response.content.decode()), str(u)) + def test_json_response_custom_encoder(self): class CustomDjangoJSONEncoder(DjangoJSONEncoder): def encode(self, o): |
