import json import printpub.post.models import printpub.post.serializers.json import printpub.user.models def test_serializes_post(mock_domain): poster = printpub.user.models.Poster() poster.save() user = printpub.user.models.LocalUser( username="wint", password="hunter2", display_name="dril", poster=poster ) user.save() post = printpub.post.models.Post( author=poster, content='"im not owned! im not owned!!", i continue to insist as i slowly shrink and transform into a corn cob', ) post_serializer = printpub.post.serializers.json.PostSerializer(post) assert post_serializer.data == { "content": '"im not owned! im not owned!!", i continue to insist as i slowly shrink and transform into a corn cob', "author": {"display_name": "dril", "username": "wint", "domain": "my.website"}, }