Skip to content

Commit

Permalink
Fix exporting job applications without eligibility diag
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisfreitag committed Sep 11, 2024
1 parent afdd220 commit 9b6fc6b
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 2 deletions.
1 change: 1 addition & 0 deletions itou/job_applications/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def _eligible_to_siae_evaluations(job_application):
job_application.approval_id is not None
and job_application.to_company.kind in evaluation_enums.EvaluationSiaesKind.Evaluable
and job_application.state == JobApplicationState.ACCEPTED
and job_application.eligibility_diagnosis
and job_application.eligibility_diagnosis.author_kind == UserKind.EMPLOYER
and job_application.eligibility_diagnosis.author_siae_id == job_application.to_company_id
and job_application.approval.start_at == job_application.hiring_start_at
Expand Down
232 changes: 232 additions & 0 deletions tests/www/apply/__snapshots__/test_list_for_siae.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,238 @@
]),
])
# ---
# name: test_list_for_siae_exports_download[for_snapshot]
list([
list([
'Civilité candidat',
'Nom candidat',
'Prénom candidat',
'Email candidat',
'Téléphone candidat',
'Date de naissance candidat',
'Ville candidat',
'Département candidat',
'Nom structure employeur',
'Type employeur',
'Métiers',
'Source de la candidature',
'Nom organisation prescripteur',
'Nom utilisateur prescripteur',
'Date de la candidature',
'Statut de la candidature',
'Dates de début d’embauche',
'Dates de fin d’embauche',
'Motifs de refus',
'Éligibilité IAE validée',
'Eligible au contrôle',
'Numéro PASS IAE',
'Début PASS IAE',
'Fin PASS IAE',
'Statut PASS IAE',
]),
list([
'MME',
'Doe',
'Jane',
'jane.doe@test.local',
'0612345678',
'01/01/1990',
'Rennes',
'35000',
'Acme inc.',
'EI',
'Candidature spontanée',
'Orienteur',
'',
'Pierre DUPONT',
'18/08/2024',
'Nouvelle candidature',
'18/08/2024',
'18/08/2026',
'',
'oui',
'non',
'',
'',
'',
'',
]),
])
# ---
# name: test_list_for_siae_exports_download[job_app_kwargs0]
list([
list([
'Civilité candidat',
'Nom candidat',
'Prénom candidat',
'Email candidat',
'Téléphone candidat',
'Date de naissance candidat',
'Ville candidat',
'Département candidat',
'Nom structure employeur',
'Type employeur',
'Métiers',
'Source de la candidature',
'Nom organisation prescripteur',
'Nom utilisateur prescripteur',
'Date de la candidature',
'Statut de la candidature',
'Dates de début d’embauche',
'Dates de fin d’embauche',
'Motifs de refus',
'Éligibilité IAE validée',
'Eligible au contrôle',
'Numéro PASS IAE',
'Début PASS IAE',
'Fin PASS IAE',
'Statut PASS IAE',
]),
list([
'MME',
'Doe',
'Jane',
'jane.doe@test.local',
'0612345678',
'01/01/1990',
'Rennes',
'35000',
'Acme inc.',
'EI',
'Candidature spontanée',
'Orienteur',
'',
'Pierre DUPONT',
'18/08/2024',
'Nouvelle candidature',
'18/08/2024',
'18/08/2026',
'',
'oui',
'non',
'',
'',
'',
'',
]),
])
# ---
# name: test_list_for_siae_exports_download[job_app_kwargs1]
list([
list([
'Civilité candidat',
'Nom candidat',
'Prénom candidat',
'Email candidat',
'Téléphone candidat',
'Date de naissance candidat',
'Ville candidat',
'Département candidat',
'Nom structure employeur',
'Type employeur',
'Métiers',
'Source de la candidature',
'Nom organisation prescripteur',
'Nom utilisateur prescripteur',
'Date de la candidature',
'Statut de la candidature',
'Dates de début d’embauche',
'Dates de fin d’embauche',
'Motifs de refus',
'Éligibilité IAE validée',
'Eligible au contrôle',
'Numéro PASS IAE',
'Début PASS IAE',
'Fin PASS IAE',
'Statut PASS IAE',
]),
list([
'MME',
'Doe',
'Jane',
'jane.doe@test.local',
'0612345678',
'01/01/1990',
'Rennes',
'35000',
'Acme inc.',
'EI',
'Candidature spontanée',
'Orienteur',
'',
'Pierre DUPONT',
'18/08/2024',
'Nouvelle candidature',
'18/08/2024',
'18/08/2026',
'',
'non',
'non',
'',
'',
'',
'',
]),
])
# ---
# name: test_list_for_siae_exports_download[no_eligibility_diag]
list([
list([
'Civilité candidat',
'Nom candidat',
'Prénom candidat',
'Email candidat',
'Téléphone candidat',
'Date de naissance candidat',
'Ville candidat',
'Département candidat',
'Nom structure employeur',
'Type employeur',
'Métiers',
'Source de la candidature',
'Nom organisation prescripteur',
'Nom utilisateur prescripteur',
'Date de la candidature',
'Statut de la candidature',
'Dates de début d’embauche',
'Dates de fin d’embauche',
'Motifs de refus',
'Éligibilité IAE validée',
'Eligible au contrôle',
'Numéro PASS IAE',
'Début PASS IAE',
'Fin PASS IAE',
'Statut PASS IAE',
]),
list([
'MME',
'Doe',
'Jane',
'jane.doe@test.local',
'0612345678',
'01/01/1990',
'Rennes',
'35000',
'Acme inc.',
'EI',
'Candidature spontanée',
'Orienteur',
'',
'Pierre DUPONT',
'18/08/2024',
'Nouvelle candidature',
'18/08/2024',
'18/08/2026',
'',
'non',
'non',
'',
'',
'',
'',
]),
])
# ---
# name: test_list_for_siae_filter_for_different_kind[geiq]
'''
<div aria-labelledby="offcanvasApplyFiltersLabel" class="c-offcanvas-filters offcanvas offcanvas-end" id="offcanvasApplyFilters" tabindex="-1">
Expand Down
11 changes: 9 additions & 2 deletions tests/www/apply/test_list_for_siae.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,16 @@ def test_list_for_siae_exports_back_to_list(client):
assert_previous_step(response, reverse("apply:list_for_siae"), back_to_list=True)


@pytest.mark.parametrize(
"job_app_kwargs",
[
pytest.param({"for_snapshot": True}, id="for_snapshot"),
pytest.param({"for_snapshot": True, "eligibility_diagnosis": None}, id="no_eligibility_diag"),
],
)
@freeze_time("2024-08-18")
def test_list_for_siae_exports_download(client, snapshot):
job_application = JobApplicationFactory(for_snapshot=True)
def test_list_for_siae_exports_download(client, job_app_kwargs, snapshot):
job_application = JobApplicationFactory(**job_app_kwargs)
client.force_login(job_application.to_company.members.get())

# Download all job applications
Expand Down

0 comments on commit 9b6fc6b

Please sign in to comment.