def test_serialize_model(self): self.maxDiff = None facility = mommy.make(Facility) serialized_data = serialize_model(facility) expected_data = FacilitySerializer(facility).data expected_data = json.dumps(expected_data, default=default) self.assertEquals(expected_data, serialized_data.get('data'))
def test_serialize_model(self): self.maxDiff = None facility = mommy.make(Facility) serialized_data = serialize_model(facility) expected_data = FacilitySerializer( facility ).data expected_data = json.dumps(expected_data, default=default) self.assertEquals(expected_data, serialized_data.get('data'))
def test_serialize_model_serializer_not_found(self): # There is no serializer named GroupSerializer # Therefore the serialize model function should return None group = mommy.make(Group) serialized_data = serialize_model(group) self.assertIsNone(serialized_data)