Skip to content
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

Déplacement de code GPS #5358

Merged
merged 1 commit into from
Jan 9, 2025
Merged

Déplacement de code GPS #5358

merged 1 commit into from
Jan 9, 2025

Conversation

tonial
Copy link
Contributor

@tonial tonial commented Jan 8, 2025

🤔 Pourquoi ?

On n'a pas très envie d'avoir du code utilisant les modèles de GPS dans users/models.py

🍰 Comment ?

Décrivez en quelques mots la solution retenue et mise en oeuvre, les difficultés ou problèmes rencontrés. Attirez l'attention sur les décisions d'architecture ou de conception importantes.

🚨 À vérifier

  • Mettre à jour le CHANGELOG_breaking_changes.md ?

🏝️ Comment tester

Les instructions pour reproduire le problème, les profils de test, le parcours spécifique à utiliser, etc. Si vous disposez d'une recette jetable, mettre l'URL pour tester dans cette partie.

💻 Captures d'écran

@tonial tonial added the no-changelog Ne doit pas figurer dans le journal des changements. label Jan 8, 2025
@tonial tonial self-assigned this Jan 8, 2025
@tonial tonial force-pushed the alaurent/gps branch 2 times, most recently from a8383b5 to eac5e1f Compare January 8, 2025 21:25
client.force_login(employer)
response = client.get(reverse("autocomplete:gps_users") + "?term=gps")
result = set(r["id"] for r in response.json()["results"])
assert result == {first_beneficiary.pk, second_beneficiary.pk, third_beneficiary.pk}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je me dis qu'une petite fonction (interne au test):

def get_autocomplete_results(user):
    client.force_login(user)
    response = client.get(reverse("autocomplete:gps_users") + "?term=gps")
    return set(r["id"] for r in response.json()["results"])

# Employers should get the 3 job seekers.
employer = EmployerFactory(with_company=True)
assert get_autocomplete_results(employer) == {first_beneficiary.pk, second_beneficiary.pk, third_beneficiary.pk}

# Authorized prescribers should get the 3 job seekers.
prescriber = PrescriberOrganizationWithMembershipFactory(authorized=True).members.get()
assert get_autocomplete_results(prescriber) == {first_beneficiary.pk, second_beneficiary.pk, third_beneficiary.pk}

...

Copy link
Contributor

@francoisfreitag francoisfreitag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯, ça me paraît également bien mieux.

Très bien de passer le test au niveau de la vue plutôt que le modèle.

@tonial tonial enabled auto-merge January 9, 2025 13:19
@tonial tonial added this pull request to the merge queue Jan 9, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 9, 2025
@tonial tonial added this pull request to the merge queue Jan 9, 2025
Merged via the queue into master with commit 1b08111 Jan 9, 2025
9 checks passed
@tonial tonial deleted the alaurent/gps branch January 9, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Ne doit pas figurer dans le journal des changements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants