import unittest.mock from printpub.user import models, serializers def test_serializes_user_with_no_links(): poster = models.Poster() poster.save() user = models.LocalUser.objects.create_user( username="wint", password="hunter2", display_name="dril", poster=poster ) serializer = serializers.WebfingerUserSerializer( user, context={"domain": "example.com"} ) assert serializer.data == {"subject": "acct:wint@example.com", "links": []}