28 lines
922 B
Python
28 lines
922 B
Python
import json
|
|
|
|
import printpub.post.models
|
|
import printpub.post.serializers.json
|
|
import printpub.user.models
|
|
|
|
|
|
def test_serializes_post():
|
|
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",
|
|
# TODO: work domain into here somehow
|
|
},
|
|
}
|