def test_decode(self): data = '{"items": [{"lastname": "1", "id": 1, "firstname": "User"}, {"lastname": "2", "id": 2, "firstname": "User"}], "total": 2}' expected_result = { 'total': 2, 'items': [ { "id": 1, "firstname": "User", "lastname": "1" }, { "id": 2, "firstname": "User", "lastname": "2" }, ] } result = serializer.decode(data) self.assertEqual(result, expected_result)
def _serialize_decode(self, data): return serializer.decode(data)
def assertResponse(self, response, status_code, result): decoded_response = serializer.decode(response.data) self.assertEquals(response.status_code, status_code) self.assertEquals(decoded_response, result)