Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6463bcae
Commit
6463bcae
authored
Jul 29, 2013
by
jsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user_api: get username into user object
so it can be used to generate unsubscribe tokens
parent
50ef0d1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
lms/djangoapps/user_api/serializers.py
+2
-2
lms/djangoapps/user_api/tests/test_views.py
+4
-2
No files found.
lms/djangoapps/user_api/serializers.py
View file @
6463bcae
...
@@ -14,8 +14,8 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
...
@@ -14,8 +14,8 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
class
Meta
:
class
Meta
:
model
=
User
model
=
User
# This list is the minimal set required by the notification service
# This list is the minimal set required by the notification service
fields
=
(
"id"
,
"email"
,
"name"
)
fields
=
(
"id"
,
"email"
,
"name"
,
"username"
)
read_only_fields
=
(
"id"
,
"email"
)
read_only_fields
=
(
"id"
,
"email"
,
"username"
)
class
UserPreferenceSerializer
(
serializers
.
HyperlinkedModelSerializer
):
class
UserPreferenceSerializer
(
serializers
.
HyperlinkedModelSerializer
):
...
...
lms/djangoapps/user_api/tests/test_views.py
View file @
6463bcae
...
@@ -74,7 +74,7 @@ class UserApiTestCase(TestCase):
...
@@ -74,7 +74,7 @@ class UserApiTestCase(TestCase):
def
assertUserIsValid
(
self
,
user
):
def
assertUserIsValid
(
self
,
user
):
"""Assert that the given user result is valid"""
"""Assert that the given user result is valid"""
self
.
assertItemsEqual
(
user
.
keys
(),
[
"email"
,
"id"
,
"name"
,
"url"
])
self
.
assertItemsEqual
(
user
.
keys
(),
[
"email"
,
"id"
,
"name"
,
"u
sername"
,
"u
rl"
])
self
.
assertSelfReferential
(
user
)
self
.
assertSelfReferential
(
user
)
def
assertPrefIsValid
(
self
,
pref
):
def
assertPrefIsValid
(
self
,
pref
):
...
@@ -196,7 +196,8 @@ class UserViewSetTest(UserApiTestCase):
...
@@ -196,7 +196,8 @@ class UserViewSetTest(UserApiTestCase):
"email"
:
user
.
email
,
"email"
:
user
.
email
,
"id"
:
user
.
id
,
"id"
:
user
.
id
,
"name"
:
user
.
profile
.
name
,
"name"
:
user
.
profile
.
name
,
"url"
:
uri
,
"username"
:
user
.
username
,
"url"
:
uri
}
}
)
)
...
@@ -334,6 +335,7 @@ class UserPreferenceViewSetTest(UserApiTestCase):
...
@@ -334,6 +335,7 @@ class UserPreferenceViewSetTest(UserApiTestCase):
"email"
:
pref
.
user
.
email
,
"email"
:
pref
.
user
.
email
,
"id"
:
pref
.
user
.
id
,
"id"
:
pref
.
user
.
id
,
"name"
:
pref
.
user
.
profile
.
name
,
"name"
:
pref
.
user
.
profile
.
name
,
"username"
:
pref
.
user
.
username
,
"url"
:
self
.
get_uri_for_user
(
pref
.
user
),
"url"
:
self
.
get_uri_for_user
(
pref
.
user
),
},
},
"key"
:
pref
.
key
,
"key"
:
pref
.
key
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment