Development #51368
un POST sur /api/users/?get_or_create=email considère même les comptes désactivés
Début:
23 février 2021
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
Il faudrait que le get du get_or_create ne prenne pas en considération les comptes deactivation/deleted
Fichiers
Révisions associées
api: ignore deleted users when using update/get_or_create (#51368)
Historique
Mis à jour par Thomas Noël il y a environ 3 ans
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
Mis à jour par Benjamin Dauvergne il y a environ 3 ans
- Fichier 0002-api-ignore-deleted-users-when-using-update-get_or_cr.patch 0002-api-ignore-deleted-users-when-using-update-get_or_cr.patch ajouté
- Fichier 0001-api-do-not-mix-get_queryset-and-filter_queryset-5136.patch 0001-api-do-not-mix-get_queryset-and-filter_queryset-5136.patch ajouté
- Tracker changé de Bug à Development
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
Mis à jour par Paul Marillonnet il y a environ 3 ans
- Statut changé de Solution proposée à 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.
Mis à jour par Paul Marillonnet il y a environ 3 ans
Paul Marillonnet a écrit :
Le build est cassé mais rien à voir avec ce ticket, je vais faire un autre ticket.
Mis à jour par Benjamin Dauvergne il y a environ 3 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit ebd152fe8669f3875cade43ba5c5990c44c97cd3 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Feb 23 15:14:32 2021 +0100 api: ignore deleted users when using update/get_or_create (#51368) commit 49233873d49c441397976419bb6d458657be1379 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Feb 23 15:04:36 2021 +0100 api: do not mix get_queryset() and filter_queryset() (#51368)
Mis à jour par Frédéric Péters il y a environ 3 ans
- Statut changé de Résolu (à déployer) à Solution déployée
api: do not mix get_queryset() and filter_queryset() (#51368)