Skip to content

Commit

Permalink
Corriger les tests sur le status réglementaire
Browse files Browse the repository at this point in the history
Etre sur que l'on utilise toujours l'ID du bon objet pour la comparaison
  • Loading branch information
Anto59290 committed Nov 15, 2024
1 parent 3bee6c1 commit 2a2d8ce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sv/tests/test_fichedetection_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,14 @@ def test_fiche_detection_numero_fiche_is_null_when_save_with_visibilite_brouillo
def test_fiche_detection_status_reglementaire_is_pre_selected(
live_server, page: Page, form_elements: FicheDetectionFormDomElements, choice_js_fill
):
statut = StatutReglementaire.objects.get(code="OQ")
organisme_nuisible, _ = OrganismeNuisible.objects.get_or_create(code_oepp="OE_XYLEFM")
organisme_nuisible.libelle_court = "Mon ON"
organisme_nuisible.save()

page.goto(f"{live_server.url}{reverse('fiche-detection-creation')}")
choice_js_fill(page, "#organisme-nuisible .choices__list--single", "Mon ON", "Mon ON")
expect(form_elements.statut_reglementaire_input).to_have_value("2")
expect(form_elements.statut_reglementaire_input).to_have_value(str(statut.id))
page.get_by_role("button", name="Enregistrer").click()

page.wait_for_timeout(600)
Expand All @@ -387,6 +388,7 @@ def test_fiche_detection_status_reglementaire_is_pre_selected(
def test_fiche_detection_status_reglementaire_is_emptied_when_unknown(
live_server, page: Page, form_elements: FicheDetectionFormDomElements, choice_js_fill
):
statut = StatutReglementaire.objects.get(code="OQ")
organisme_nuisible, _ = OrganismeNuisible.objects.get_or_create(code_oepp="OE_XYLEFM")
organisme_nuisible.libelle_court = "Mon ON"
organisme_nuisible.save()
Expand All @@ -397,7 +399,7 @@ def test_fiche_detection_status_reglementaire_is_emptied_when_unknown(

page.goto(f"{live_server.url}{reverse('fiche-detection-creation')}")
choice_js_fill(page, "#organisme-nuisible .choices__list--single", "Mon ON", "Mon ON")
expect(form_elements.statut_reglementaire_input).to_have_value("2")
expect(form_elements.statut_reglementaire_input).to_have_value(str(statut.id))
choice_js_fill(page, "#organisme-nuisible .choices__list--single", "Pas mon ON", "Pas mon ON")
expect(form_elements.statut_reglementaire_input).to_have_value("")
page.get_by_role("button", name="Enregistrer").click()
Expand Down

0 comments on commit 2a2d8ce

Please sign in to comment.