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

Ajout de tests bouts en bouts #19

Merged
merged 3 commits into from May 4, 2023
Merged

Ajout de tests bouts en bouts #19

merged 3 commits into from May 4, 2023

Conversation

tonial
Copy link
Collaborator

@tonial tonial commented Apr 27, 2023

**Carte Notion : ** https://www.notion.so/plateforme-inclusion/Refonte-Tester-les-parcours-d-crits-dans-la-doc-produit-480308abed9644e986adf329d2bd09fd?pvs=4

Pourquoi ?

Pour s’assurer que chaque parcours utilisateur fonctionne de A à Z

Il manque encore (à faire dans une autre PR)

  • l'espace personnel
  • la reprise des éléments "sur un autre navigateur" qui doivent être améliorés

Ne lire que le dernier commit

@tonial tonial self-assigned this Apr 27, 2023
@tonial tonial force-pushed the alaurent/functional_test branch 10 times, most recently from 8225b7d to ea308df Compare May 2, 2023 14:50
inclusion_connect/tests.py Outdated Show resolved Hide resolved
ApplicationFactory(client_id=OIDC_PARAMS["client_id"])
user = UserFactory()

# Entry point is OIDC registration endpoint -> redirected to accounts:registration
Copy link
Collaborator

Choose a reason for hiding this comment

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

Le commentaire est faux (copy-pasta) et paraphrase le code.

Suggested change
# Entry point is OIDC registration endpoint -> redirected to accounts:registration

response = client.get(auth_complete_url, follow=True)
assert response.status_code == 400

# Entry point is OIDC activation endpoint -> redirected to accounts:registration
Copy link
Collaborator

Choose a reason for hiding this comment

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

Le commentaire est faux (copy-pasta) et paraphrase le code.

Suggested change
# Entry point is OIDC activation endpoint -> redirected to accounts:registration

ApplicationFactory(client_id=OIDC_PARAMS["client_id"])
user = UserFactory.build()

# Entry point is OIDC registration endpoint -> redirected to accounts:registration
Copy link
Collaborator

Choose a reason for hiding this comment

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

Le commentaire paraphrase le code.

Suggested change
# Entry point is OIDC registration endpoint -> redirected to accounts:registration

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

J'ai corrigé les commentaires.

Par contre, sur des tests de ce niveau là, et aussi long, je trouve plus clair d'avoir des explication en prose.
Ce n'est pas ton avis ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Je ne trouve pas. Le bout de code fait :

    auth_url = reverse("oidc_overrides:authorize")
    auth_complete_url = add_url_params(auth_url, OIDC_PARAMS)
    response = client.get(auth_complete_url)
    assertRedirects(response, reverse("accounts:login"))
  1. oidc_overrides -> c’est un endpoint oidc
  2. assertRedirects(response, reverse("accounts:login")) -> redirige vers accounts:login

Le commentaire ne m’apprend rien. Le commentaire est plutôt pour expliquer pourquoi, peut-être : Compatibility with OIDC, Django auth handles authentication..

Copy link
Collaborator

Choose a reason for hiding this comment

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

Après, ce n’est que du commentaire, donc tu peux faire comme tu préfères, je m’en accommoderai facilement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Le soucis c'est plus les étapes suivantes à faire des get/post sur response.url (ce qui peut être plus dur à suivre donc).

Je vais tester de limiter les commentaires aux endroits où l'url appelée n'est pas explicite, et sans expliquer ce qui se passe ensuite.

inclusion_connect/tests.py Outdated Show resolved Hide resolved
@tonial tonial force-pushed the alaurent/functional_test branch 4 times, most recently from 25209e3 to b4e4e24 Compare May 3, 2023 06:06
Copy link
Collaborator

@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.

J’imagine qu’il manque un rebase pour lier l’utilisateur et l’application.
Sur le dernier commit : s/functionnal/functional.

inclusion_connect/oidc_overrides/factories.py Outdated Show resolved Hide resolved
inclusion_connect/oidc_overrides/views.py Show resolved Hide resolved
@tonial tonial force-pushed the alaurent/functional_test branch 3 times, most recently from 089a994 to d3908cf Compare May 4, 2023 14:21
Copy link
Collaborator

@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.

Autrement c’est tout bon :)

inclusion_connect/oidc_overrides/factories.py Outdated Show resolved Hide resolved
inclusion_connect/tests.py Outdated Show resolved Hide resolved
tonial added 3 commits May 4, 2023 17:20
We want to test every flow described in our product documentation
This way, if is_authenticated becomes a method, it would crash
@tonial tonial force-pushed the alaurent/functional_test branch from d3908cf to 9b94f24 Compare May 4, 2023 15:24
@tonial tonial merged commit 0a4d519 into main May 4, 2023
1 check passed
@tonial tonial deleted the alaurent/functional_test branch May 4, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants