Example #1
0
    def test_serialize_one(self):
        data = SearchSerializer(self.obj1).data

        assert set(data.keys()) == self.expected_keys

        for k, v in data.items():
            assert getattr(self.obj1, k) == v
Example #2
0
 def test_serialize_many(self):
     data = SearchSerializer(Search.objects.all(), many=True).data  # noqa
     assert len(data) == 2
     for d in data:
         assert set(d.keys()) == self.expected_keys