I've an issues finding the ideal way to test the API endpoint developed in Django with the Django Rest Framework. I'm using the integrated APITestCase and performing the request like this:
response = self.client.get('/resources')
The official documentation (http://www.django-rest-framework.org/api-guide/testing) states that is better to use response.data
instaed of response.content
. My model includes a DateTimeField
field and the response.data
looks like this:
{'id': 1, 'issued': datetime.datetime(2014, 5, 3, 0, 0, tzinfo=<UTC>)}
Where as the real response in a browser looks like this:
{"id": 1, "issued": "2014-05-03T00:00:00Z"}
So I'm not sure how to assert that those two are equal!?