diff --git a/tests/users/factories.py b/tests/users/factories.py index 672313febf7..46cd8639f7c 100644 --- a/tests/users/factories.py +++ b/tests/users/factories.py @@ -347,7 +347,7 @@ class Params: @factory.lazy_attribute def nir(self): - gender = random.choice([1, 2]) + gender = "1" if self.user.title == "M" else "2" if self.birthdate: year = self.birthdate.strftime("%y") month = self.birthdate.strftime("%m") diff --git a/tests/www/apply/test_submit.py b/tests/www/apply/test_submit.py index 74660d77175..013a939a308 100644 --- a/tests/www/apply/test_submit.py +++ b/tests/www/apply/test_submit.py @@ -3097,7 +3097,7 @@ def _check_everything_allowed(self, user, extra_post_data_1=None): PROCESS_TITLE = "Modification du compte candidat" post_data = { - "title": "M", + "title": self.job_seeker.title, "first_name": NEW_FIRST_NAME, "last_name": "New last name", "birthdate": self.job_seeker.jobseeker_profile.birthdate, @@ -3657,6 +3657,8 @@ def test_detect_existing_job_seeker(client): job_seeker = JobSeekerFactory( jobseeker_profile__nir="", + jobseeker_profile__birthdate=datetime.date(1997, 1, 1), + title="M", first_name="Jérémy", email="jeremy@example.com", ) @@ -3734,7 +3736,11 @@ def test_detect_existing_job_seeker(client): "lack_of_nir_reason": "", "lack_of_nir": False, } + print("-----------------------------------") + print(post_data) + print("-----------------------------------") response = client.post(next_url, data=post_data) + assertContains( response, (