class DjangoSerializerTest(TestCase): def setUp(self): self.serializer = DjangoSerializer() def test_paginator_serializer(self): serialized = { "current": page.number, "list": [{'key': 1, 'value': 1}, {'key': 2, 'value': 2}, None], # previous, current, next (if we have) "num_pages": page.paginator.num_pages } simple = self.serializer.flatten(page) self.assertEqual(simple, serialized)
def setUp(self): self.serializer = DjangoSerializer()