diff --git a/AUTHORS b/AUTHORS index d90d4be3..f3e3d2b2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -21,3 +21,4 @@ Tim Selman Yaniv Peer Mohammed Ali Zubair Jason Housley +Beni Keller diff --git a/CHANGELOG.md b/CHANGELOG.md index 4072276c..bed4287d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ any parts of the framework not mentioned in the documentation should generally b * Do not render `write_only` relations * Do not skip empty one-to-one relationships * Allow `HyperlinkRelatedField` to be used with [related urls](https://django-rest-framework-json-api.readthedocs.io/en/stable/usage.html?highlight=related%20links#related-urls) - +* Fixed hardcoded year 2018 in tests ([#539](https://github.com/django-json-api/django-rest-framework-json-api/issues/539)) ## [2.6.0] - 2018-09-20 diff --git a/example/tests/test_views.py b/example/tests/test_views.py index 0f249139..d4a3d062 100644 --- a/example/tests/test_views.py +++ b/example/tests/test_views.py @@ -1,5 +1,6 @@ import json +from datetime import datetime from django.test import RequestFactory from django.utils import timezone from rest_framework.exceptions import NotFound @@ -466,7 +467,7 @@ def test_get_object_gives_correct_blog(self): 'attributes': {'name': self.blog.name}, 'id': '{}'.format(self.blog.id), 'links': {'self': 'http://testserver/blogs/{}'.format(self.blog.id)}, - 'meta': {'copyright': 2018}, + 'meta': {'copyright': datetime.now().year}, 'relationships': {'tags': {'data': []}}, 'type': 'blogs' }, diff --git a/example/tests/unit/test_default_drf_serializers.py b/example/tests/unit/test_default_drf_serializers.py index f43925a9..61e07cb5 100644 --- a/example/tests/unit/test_default_drf_serializers.py +++ b/example/tests/unit/test_default_drf_serializers.py @@ -1,6 +1,7 @@ import json import pytest +from datetime import datetime from django.urls import reverse from rest_framework import viewsets from rest_framework.serializers import ModelSerializer, SerializerMethodField @@ -108,7 +109,7 @@ def test_blog_create(client): 'attributes': {'name': blog.name}, 'id': '{}'.format(blog.id), 'links': {'self': 'http://testserver/blogs/{}'.format(blog.id)}, - 'meta': {'copyright': 2018}, + 'meta': {'copyright': datetime.now().year}, 'relationships': {'tags': {'data': []}}, 'type': 'blogs' }, @@ -129,7 +130,7 @@ def test_get_object_gives_correct_blog(client, blog, entry): 'attributes': {'name': blog.name}, 'id': '{}'.format(blog.id), 'links': {'self': 'http://testserver/blogs/{}'.format(blog.id)}, - 'meta': {'copyright': 2018}, + 'meta': {'copyright': datetime.now().year}, 'relationships': {'tags': {'data': []}}, 'type': 'blogs' }, @@ -151,7 +152,7 @@ def test_get_object_patches_correct_blog(client, blog, entry): 'attributes': {'name': new_name}, 'id': '{}'.format(blog.id), 'links': {'self': 'http://testserver/blogs/{}'.format(blog.id)}, - 'meta': {'copyright': 2018}, + 'meta': {'copyright': datetime.now().year}, 'relationships': {'tags': {'data': []}}, 'type': 'blogs' }, @@ -167,7 +168,7 @@ def test_get_object_patches_correct_blog(client, blog, entry): 'attributes': {'name': new_name}, 'id': '{}'.format(blog.id), 'links': {'self': 'http://testserver/blogs/{}'.format(blog.id)}, - 'meta': {'copyright': 2018}, + 'meta': {'copyright': datetime.now().year}, 'relationships': {'tags': {'data': []}}, 'type': 'blogs' },