-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use MinimalUserProfileSerializer for AccountViewSet for non-developers #23192
Use MinimalUserProfileSerializer for AccountViewSet for non-developers #23192
Conversation
@@ -1268,7 +1268,28 @@ def test_view_deleted(self): | |||
response = self.client.get(self.url) | |||
assert response.status_code == 404 | |||
|
|||
def test_is_not_full_public_profile_because_not_developer(self): | |||
def test_is_not_full_public_profile_because_not_developer_but_fields_present(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I would rather this be two different tests, but since we are trying to cherry-pick no need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is two tests:
test_is_not_full_public_profile_because_not_developer_but_fields_present
tests the case with the shimtest_is_not_full_public_profile_because_not_developer_no_fields
tests without the shim is, but as it's identical to the originaltest_is_not_full_public_profile_because_not_developer
it doesn't show any changed lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the 2 sets of assertions in the first test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URL: http://olympia.test/api/v3/accounts/account/1/
Response:
{
"id": 1,
"name": "Test",
"url": "http://olympia.test/en-US/firefox/user/1/",
"username": "local_admin",
"average_addon_rating": null,
"created": "2025-03-03T11:06:15Z",
"biography": null,
"has_anonymous_display_name": false,
"has_anonymous_username": false,
"homepage": null,
"is_addon_developer": true,
"is_artist": true,
"location": null,
"occupation": null,
"num_addons_listed": 0,
"picture_type": null,
"picture_url": null
}
URL: http://olympia.test/api/v4/accounts/account/1/
{
"id": 1,
"name": "Test",
"url": "http://olympia.test/en-US/firefox/user/1/",
"username": "local_admin",
"average_addon_rating": null,
"created": "2025-03-03T11:06:15Z",
"biography": null,
"has_anonymous_display_name": false,
"has_anonymous_username": false,
"homepage": null,
"is_addon_developer": true,
"is_artist": true,
"location": null,
"occupation": null,
"num_addons_listed": 0,
"picture_type": null,
"picture_url": null
}
Note
only on v5 I got an error when using an invalid sessionID cookie
URL: http://olympia.test/api/v5/accounts/account/1/
{
"id": 1,
"name": "Test",
"url": "http://olympia.test/en-US/firefox/user/1/",
"username": "local_admin",
"average_addon_rating": null,
"created": "2025-03-03T11:06:15Z",
"biography": null,
"has_anonymous_display_name": false,
"has_anonymous_username": false,
"homepage": null,
"is_addon_developer": true,
"is_artist": true,
"location": null,
"occupation": null,
"num_addons_listed": 0,
"picture_type": null,
"picture_url": null
}
@KevinMind sounds like something that needs further investigation (but not related to this change) |
Fixes: mozilla/addons#15479 - follow up for mozilla/addons#15402, fixing a bug in #23154
Description
See issue. We were using the wrong serializer that didn't have the API_GATE integration to shim the fields.
Context
Testing
access any
/api/v[3|4|5]/accounts/account/(int:user_id)/
url without auth; see all the fields present, but with biography, etc (see original issue and pr) shim'd asnull
rather than omitted.Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.