Skip to content

Commit e18e59a

Browse files
committed
AMOENG-2407 - Use FullUserProfileSerializer for the lookup API endpoint
1 parent b51c69b commit e18e59a

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

docs/topics/api/accounts.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ Account Lookup
110110
.. note::
111111
This API requires :doc:`authentication <auth>` and ``Users:Lookup`` permission.
112112

113-
This endpoint looks up one or more accounts by email address and returns their full details.
113+
This endpoint looks up one or more accounts by email address.
114114
Since multiple accounts can share the same email address, the response is always a list.
115115
Deleted accounts are excluded from results.
116116

117117
.. http:get:: /api/v5/accounts/account/lookup/
118118
119119
:query string email: The email address to look up.
120120

121-
Returns a list of :ref:`account objects <account-object-self>`.
121+
Returns a list of :ref:`account objects <account-object>`.
122122

123123
:statuscode 200: account(s) found.
124124
:statuscode 400: ``email`` query parameter is missing.

src/olympia/accounts/tests/test_views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,9 @@ def test_lookup_by_email(self):
14091409
response = self.get(self.url, data={'email': self.target_user.email})
14101410
assert response.status_code == 200
14111411
assert len(response.data) == 1
1412-
assert response.data[0]['email'] == self.target_user.email
14131412
assert response.data[0]['id'] == self.target_user.pk
1413+
assert 'email' not in response.data[0]
1414+
assert 'last_login_ip' not in response.data[0]
14141415

14151416
def test_lookup_multiple_users_same_email(self):
14161417
# Multiple accounts can share the same email (no unique constraint).

src/olympia/accounts/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def lookup(self, request):
559559
)
560560
if not users.exists():
561561
raise exceptions.NotFound()
562-
serializer = SelfUserProfileSerializer(
562+
serializer = FullUserProfileSerializer(
563563
users, many=True, context={'request': request}
564564
)
565565
return Response(serializer.data)

0 commit comments

Comments
 (0)