Development #51368
un POST sur /api/users/?get_or_create=email considère même les comptes désactivés
Start date:
23 Feb 2021
Due date:
% Done:
0%
Estimated time:
Patch proposed:
Yes
Planning:
No
Description
Il faudrait que le get du get_or_create ne prenne pas en considération les comptes deactivation/deleted
Files
History
Updated by Thomas Noël 2 days ago
Voici, selon moi, le test qui devrait passer :
diff --git a/tests/test_api.py b/tests/test_api.py index cf276c6e..5b13d81b 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1462,6 +1462,11 @@ def test_api_users_get_or_create(settings, app, admin): assert User.objects.get(id=id).password != password assert User.objects.get(id=id).check_password('secret') + # do not get deleted user, create a new one + User.objects.get(id=id).mark_as_deleted() + resp = app.post_json('/api/users/?get_or_create=email', params=payload, status=200) + assert id != resp.json['id'] + def test_api_users_get_or_create_email_is_unique(settings, app, admin): settings.A2_EMAIL_IS_UNIQUE = True
Updated by Benjamin Dauvergne 1 day ago
- Patch proposed changed from No to Yes
- Status changed from Nouveau to Solution proposée
- Tracker changed from Bug to Development
- File 0001-api-do-not-mix-get_queryset-and-filter_queryset-5136.patch 0001-api-do-not-mix-get_queryset-and-filter_queryset-5136.patch added
- File 0002-api-ignore-deleted-users-when-using-update-get_or_cr.patch 0002-api-ignore-deleted-users-when-using-update-get_or_cr.patch added
Updated by Paul Marillonnet 1 day ago
- Status changed from Solution proposée to Solution validée
Le build est cassé mais rien à voir avec ce ticket, je vais faire un autre ticket.
Sinon c’est bon pour moi.
Updated by Paul Marillonnet 1 day ago
Paul Marillonnet a écrit :
Le build est cassé mais rien à voir avec ce ticket, je vais faire un autre ticket.