Commit 6463bcae by jsa

user_api: get username into user object

so it can be used to generate unsubscribe tokens
parent 50ef0d1c
......@@ -14,8 +14,8 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
# This list is the minimal set required by the notification service
fields = ("id", "email", "name")
read_only_fields = ("id", "email")
fields = ("id", "email", "name", "username")
read_only_fields = ("id", "email", "username")
class UserPreferenceSerializer(serializers.HyperlinkedModelSerializer):
......
......@@ -74,7 +74,7 @@ class UserApiTestCase(TestCase):
def assertUserIsValid(self, user):
"""Assert that the given user result is valid"""
self.assertItemsEqual(user.keys(), ["email", "id", "name", "url"])
self.assertItemsEqual(user.keys(), ["email", "id", "name", "username", "url"])
self.assertSelfReferential(user)
def assertPrefIsValid(self, pref):
......@@ -196,7 +196,8 @@ class UserViewSetTest(UserApiTestCase):
"email": user.email,
"id": user.id,
"name": user.profile.name,
"url": uri,
"username": user.username,
"url": uri
}
)
......@@ -334,6 +335,7 @@ class UserPreferenceViewSetTest(UserApiTestCase):
"email": pref.user.email,
"id": pref.user.id,
"name": pref.user.profile.name,
"username": pref.user.username,
"url": self.get_uri_for_user(pref.user),
},
"key": pref.key,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment