Skip to content

Commit 15090b2

Browse files
committed
[OS-1595] Access titles > allow to select the first cycle exam without certificate
1 parent ee3e768 commit 15090b2

File tree

3 files changed

+47
-29
lines changed

3 files changed

+47
-29
lines changed

infrastructure/admission/shared_kernel/repository/titre_acces_selectionnable.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# The core business involves the administration of students, teachers,
77
# courses, programs and so on.
88
#
9-
# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be)
9+
# Copyright (C) 2015-2026 Université catholique de Louvain (http://www.uclouvain.be)
1010
#
1111
# This program is free software: you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published by
@@ -53,8 +53,10 @@
5353
from admission.models.base import (
5454
BaseAdmission,
5555
)
56-
from admission.models.valuated_epxeriences import AdmissionEducationalValuatedExperiences, \
57-
AdmissionProfessionalValuatedExperiences
56+
from admission.models.valuated_epxeriences import (
57+
AdmissionEducationalValuatedExperiences,
58+
AdmissionProfessionalValuatedExperiences,
59+
)
5860
from base.utils.utils import format_academic_year
5961
from ddd.logic.shared_kernel.profil.domain.service.parcours_interne import (
6062
IExperienceParcoursInterneTranslator,
@@ -177,10 +179,7 @@ def search_by_proposition(
177179
formatted_high_school_diploma_name_variables['country'] = (
178180
high_school_diploma.country.name if has_default_language else high_school_diploma.country.name_en
179181
)
180-
elif (
181-
admission.candidate.exam_high_school_diploma_alternative
182-
and admission.candidate.exam_high_school_diploma_alternative[0].certificate
183-
):
182+
elif admission.candidate.exam_high_school_diploma_alternative:
184183
high_school_diploma = admission.candidate.exam_high_school_diploma_alternative[0]
185184
formatted_high_school_diploma_name = '{title}'
186185
formatted_high_school_diploma_name_variables['title'] = gettext("Bachelor's course entrance exam")

tests/commands/general_education/test_get_access_titles.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ def test_get_access_title_with_high_school_diploma(self, confirm_multiple_upload
461461
)
462462
)
463463

464-
self.assertEqual(len(access_titles), 0)
464+
self.assertEqual(len(access_titles), 1)
465+
self.assertIn(high_school_diploma_alternative.uuid, access_titles)
465466

466467
high_school_diploma_alternative.certificate = ['file.pdf']
467468
high_school_diploma_alternative.save()

tests/views/general_education/checklist/test_faculty_decision.py

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# The core business involves the administration of students, teachers,
77
# courses, programs and so on.
88
#
9-
# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be)
9+
# Copyright (C) 2015-2026 Université catholique de Louvain (http://www.uclouvain.be)
1010
#
1111
# This program is free software: you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published by
@@ -411,7 +411,7 @@ def test_send_to_faculty_with_sic_user_in_valid_sic_statuses_but_with_invalid_re
411411
response = self.client.post(self.url, **self.default_headers)
412412

413413
# Check the response
414-
program_email = EmailFonctionProgrammeFactory(
414+
EmailFonctionProgrammeFactory(
415415
programme=self.general_admission.training.education_group,
416416
type=TypeEmailFonctionProgramme.DESTINATAIRE_ADMISSION.name,
417417
premiere_annee=False,
@@ -515,7 +515,9 @@ def setUp(self) -> None:
515515
patched.return_value = 'foobar'
516516
self.addCleanup(self.get_remote_token_patcher.stop)
517517

518-
self.save_raw_content_remotely_patcher = mock.patch('osis_document_components.services.save_raw_content_remotely')
518+
self.save_raw_content_remotely_patcher = mock.patch(
519+
'osis_document_components.services.save_raw_content_remotely'
520+
)
519521
patched = self.save_raw_content_remotely_patcher.start()
520522
patched.return_value = 'a-token'
521523
self.addCleanup(self.save_raw_content_remotely_patcher.stop)
@@ -870,9 +872,19 @@ def test_send_to_sic_with_fac_user_in_specific_statuses_to_approve_with_secondar
870872
response = self.client.post(self.url + '?approval=1', **self.default_headers)
871873
self.assertEqual(response.status_code, 200)
872874

873-
# Check that the admission has not been updated
875+
# Check that the admission has been updated
874876
self.general_admission.refresh_from_db()
875-
self.assertEqual(self.general_admission.status, ChoixStatutPropositionGenerale.TRAITEMENT_FAC.name)
877+
self.assertEqual(self.general_admission.status, ChoixStatutPropositionGenerale.RETOUR_DE_FAC.name)
878+
879+
self.get_pdf_from_template_patcher.assert_called_once()
880+
pdf_context = self.get_pdf_from_template_patcher.call_args_list[0][0][2]
881+
882+
self.assertIn('access_titles_names', pdf_context)
883+
self.assertEqual(len(pdf_context['access_titles_names']), 1)
884+
self.assertEqual(pdf_context['access_titles_names'][0], secondary_studies_base_title)
885+
886+
self.general_admission.status = ChoixStatutPropositionGenerale.TRAITEMENT_FAC.name
887+
self.general_admission.save()
876888

877889
diploma_alternative.certificate = ['token.pdf']
878890
diploma_alternative.save()
@@ -1041,7 +1053,7 @@ def test_send_to_sic_with_fac_user_to_approve_with_internal_experience_as_access
10411053
decision=DecisionResultatCycle.DISTINCTION.name,
10421054
sigle_formation="SF1",
10431055
)
1044-
pce_a_uuid = str(uuid.UUID(int=pce_a.pk))
1056+
str(uuid.UUID(int=pce_a.pk))
10451057
pce_a_pae_a = InscriptionProgrammeAnnuelFactory(
10461058
programme_cycle=pce_a,
10471059
statut=StatutInscriptionProgrammAnnuel.ETUDIANT_UCL.name,
@@ -1052,8 +1064,6 @@ def test_send_to_sic_with_fac_user_to_approve_with_internal_experience_as_access
10521064

10531065
self.general_admission.internal_access_titles.add(pce_a)
10541066

1055-
candidate = self.general_admission.candidate
1056-
10571067
response = self.client.post(self.url + '?approval=1', **self.default_headers)
10581068
self.assertEqual(response.status_code, 200)
10591069

@@ -1073,9 +1083,9 @@ def test_send_to_sic_with_fac_user_in_specific_statuses_without_approving_or_ref
10731083
self.client.force_login(user=self.fac_manager_user)
10741084

10751085
self.general_admission.status = ChoixStatutPropositionGenerale.TRAITEMENT_FAC.name
1076-
self.general_admission.checklist['current']['decision_facultaire'][
1077-
'statut'
1078-
] = ChoixStatutChecklist.GEST_REUSSITE.name
1086+
self.general_admission.checklist['current']['decision_facultaire']['statut'] = (
1087+
ChoixStatutChecklist.GEST_REUSSITE.name
1088+
)
10791089
self.general_admission.save()
10801090

10811091
# Invalid request -> We need to be in the right status
@@ -1089,9 +1099,9 @@ def test_send_to_sic_with_fac_user_in_specific_statuses_without_approving_or_ref
10891099
frozen_time.move_to('2022-01-02')
10901100

10911101
# Valid request
1092-
self.general_admission.checklist['current']['decision_facultaire'][
1093-
'statut'
1094-
] = ChoixStatutChecklist.INITIAL_CANDIDAT.name
1102+
self.general_admission.checklist['current']['decision_facultaire']['statut'] = (
1103+
ChoixStatutChecklist.INITIAL_CANDIDAT.name
1104+
)
10951105
self.general_admission.save()
10961106

10971107
response = self.client.post(self.url, **self.default_headers)
@@ -1131,9 +1141,9 @@ def test_send_to_sic_with_sic_user_in_specific_statuses_without_approving_or_ref
11311141
self.client.force_login(user=self.sic_manager_user)
11321142

11331143
self.general_admission.status = ChoixStatutPropositionGenerale.TRAITEMENT_FAC.name
1134-
self.general_admission.checklist['current']['decision_facultaire'][
1135-
'statut'
1136-
] = ChoixStatutChecklist.GEST_REUSSITE.name
1144+
self.general_admission.checklist['current']['decision_facultaire']['statut'] = (
1145+
ChoixStatutChecklist.GEST_REUSSITE.name
1146+
)
11371147
self.general_admission.save()
11381148

11391149
frozen_time.move_to('2022-01-02')
@@ -1224,7 +1234,9 @@ def setUp(self) -> None:
12241234
patched.return_value = 'foobar'
12251235
self.addCleanup(self.get_remote_token_patcher.stop)
12261236

1227-
self.save_raw_content_remotely_patcher = mock.patch('osis_document_components.services.save_raw_content_remotely')
1237+
self.save_raw_content_remotely_patcher = mock.patch(
1238+
'osis_document_components.services.save_raw_content_remotely'
1239+
)
12281240
patched = self.save_raw_content_remotely_patcher.start()
12291241
patched.return_value = 'a-token'
12301242
self.addCleanup(self.save_raw_content_remotely_patcher.stop)
@@ -1573,7 +1585,9 @@ def setUp(self) -> None:
15731585
patched.return_value = 'foobar'
15741586
self.addCleanup(self.get_remote_token_patcher.stop)
15751587

1576-
self.save_raw_content_remotely_patcher = mock.patch('osis_document_components.services.save_raw_content_remotely')
1588+
self.save_raw_content_remotely_patcher = mock.patch(
1589+
'osis_document_components.services.save_raw_content_remotely'
1590+
)
15771591
patched = self.save_raw_content_remotely_patcher.start()
15781592
patched.return_value = 'a-token'
15791593
self.addCleanup(self.save_raw_content_remotely_patcher.stop)
@@ -2353,7 +2367,9 @@ def setUp(self) -> None:
23532367
patched.return_value = 'foobar'
23542368
self.addCleanup(self.get_remote_token_patcher.stop)
23552369

2356-
self.save_raw_content_remotely_patcher = mock.patch('osis_document_components.services.save_raw_content_remotely')
2370+
self.save_raw_content_remotely_patcher = mock.patch(
2371+
'osis_document_components.services.save_raw_content_remotely'
2372+
)
23572373
patched = self.save_raw_content_remotely_patcher.start()
23582374
patched.return_value = 'a-token'
23592375
self.addCleanup(self.save_raw_content_remotely_patcher.stop)
@@ -2564,7 +2580,9 @@ def setUp(self) -> None:
25642580
patched.return_value = 'foobar'
25652581
self.addCleanup(self.get_remote_token_patcher.stop)
25662582

2567-
self.save_raw_content_remotely_patcher = mock.patch('osis_document_components.services.save_raw_content_remotely')
2583+
self.save_raw_content_remotely_patcher = mock.patch(
2584+
'osis_document_components.services.save_raw_content_remotely'
2585+
)
25682586
patched = self.save_raw_content_remotely_patcher.start()
25692587
patched.return_value = 'a-token'
25702588
self.addCleanup(self.save_raw_content_remotely_patcher.stop)

0 commit comments

Comments
 (0)