def test_serialize_proxy_model(self): "Handle proxy models in the serialization." profile = ProxyProfile(description="I'm a proxy.", url="http://example.com", user=User.objects.get(username='******')) profile.save() json_field = SerializedObjectField() self.assertEqual( json_field._serialize(profile), '[{"pk": 2, "model": "tests.proxyprofile", "fields": ' '{"url": "http://example.com", "user": 2, ' '"description": "I\'m a proxy."}}]',)
def test_serialize_proxy_model(self): "Handle proxy models in the serialization." profile = ProxyProfile(description="I'm a proxy.", url="http://example.com", user=User.objects.get(username='******')) profile.save() json_field = SerializedObjectField() self.assertEqual( json_field._serialize(profile), '[{"pk": 2, "model": "tests.proxyprofile", "fields": ' '{"url": "http://example.com", "user": 2, ' '"description": "I\'m a proxy."}}]', )
def test_serialize_proxy_model(self): "Handle proxy models in the serialization." profile = ProxyProfile(description="I'm a proxy.", url="http://example.com", user=User.objects.get(username='******')) profile.save() json_field = SerializedObjectField() serialized_str = json_field._serialize(profile) self.assertIn('"pk": 2', serialized_str) self.assertIn('"model": "tests.proxyprofile"', serialized_str) self.assertIn('"url": "http://example.com"', serialized_str) self.assertIn('"user": 2', serialized_str) self.assertIn('"description": "I\'m a proxy."', serialized_str) self.assertIn('"fields": {', serialized_str)