Added a test case for JSON rendering of tzinfo, and added pytz for running tests

This commit is contained in:
Joey Wilhelm 2015-12-17 09:20:43 -07:00
parent 2814801651
commit 76c5e938f1
3 changed files with 13 additions and 2 deletions

View File

@ -2,3 +2,4 @@
markdown==2.5.2
django-guardian==1.3.0
django-filter==0.10.0
pytz==2015.7

View File

@ -8,8 +8,8 @@ from collections import MutableMapping, OrderedDict
from django.conf.urls import include, url
from django.core.cache import cache
from django.db import models
from django.test import TestCase
from django.utils import six
from django.test import TestCase, override_settings
from django.utils import six, timezone
from django.utils.translation import ugettext_lazy as _
from rest_framework import permissions, serializers, status
@ -361,6 +361,13 @@ class JSONRendererTests(TestCase):
content = renderer.render(obj, 'application/json; indent=2')
self.assertEqual(strip_trailing_whitespace(content.decode('utf-8')), _indented_repr)
@override_settings(TIME_ZONE='America/Los_Angeles')
def test_render_tzinfo_object(self):
tzinfo = timezone.get_current_timezone()
renderer = JSONRenderer()
content = renderer.render(tzinfo)
self.assertEqual(content, b'"America/Los_Angeles"')
class UnicodeJSONRendererTests(TestCase):
"""

View File

@ -37,6 +37,7 @@ deps =
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0
pytz==2015.7
[testenv:py34-django19]
deps =
@ -44,6 +45,7 @@ deps =
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0
pytz==2015.7
[testenv:py35-django19]
deps =
@ -51,3 +53,4 @@ deps =
-rrequirements/requirements-testing.txt
markdown==2.5.2
django-filter==0.10.0
pytz==2015.7