Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
celine-m-s committed Aug 9, 2024
1 parent 8d79e75 commit e278c93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 11 additions & 5 deletions tests/www/apply/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1682,10 +1682,16 @@ def create_job_application(self, *args, **kwargs):
"job_seeker": self.job_seeker,
"to_company": self.company,
"hiring_end_at": None,
"eligibility_diagnosis__with_certifiable_criteria": True,
} | kwargs
if "with_geiq_eligibility_diagnosis" not in kwargs:
kwargs.setdefault("with_iae_eligibility_diagnosis", True)
if kwargs.get("with_certifiable_criteria"):
del kwargs["with_certifiable_criteria"]
kwargs = {
"eligibility_diagnosis__with_certifiable_criteria": True,
"eligibility_diagnosis__author_siae": self.company,
"eligibility_diagnosis__author_kind": AuthorKind.EMPLOYER,
} | kwargs
return JobApplicationSentByJobSeekerFactory(**kwargs)

def _accept_view_post_data(self, job_application, post_data=None):
Expand Down Expand Up @@ -2424,7 +2430,7 @@ def test_accept_iae__criteria_can_be_certified(self):
######### birth place and birth country are required.
birthdate = datetime.date(1995, 12, 27)
job_application = self.create_job_application(
eligibility_diagnosis__with_certifiable_criteria=True,
with_certifiable_criteria=True,
job_seeker__birthdate=birthdate,
)
url_accept = reverse("apply:accept", kwargs={"job_application_id": job_application.pk})
Expand Down Expand Up @@ -2525,7 +2531,7 @@ def test_accept_geiq__criteria_can_be_certified(self):
def test_accept_no_siae__criteria_can_be_certified(self):
company = CompanyFactory(not_subject_to_eligibility=True, with_membership=True, with_jobs=True)
job_application = self.create_job_application(
eligibility_diagnosis__with_certifiable_criteria=True,
with_certifiable_criteria=True,
selected_jobs=company.jobs.all(),
to_company=company,
)
Expand Down Expand Up @@ -2553,7 +2559,7 @@ def test_criteria__criteria_not_certificable(self):
# No criteria to be certified: the form should not appear
# and it should not be valided.
##############################
job_application = self.create_job_application(eligibility_diagnosis__with_not_certifiable_criteria=True)
job_application = self.create_job_application()
url_accept = reverse("apply:accept", kwargs={"job_application_id": job_application.pk})

employer = job_application.to_company.members.first()
Expand All @@ -2571,7 +2577,7 @@ def test_criteria__criteria_not_certificable(self):

def test_accept_updated_birthdate_invalidating_birth_place(self):
# tests for a rare case where the birthdate will be cleaned for sharing between forms during the accept process
job_application = self.create_job_application()
job_application = self.create_job_application(with_certifiable_criteria=True)

# required assumptions for the test case
assert self.company.is_subject_to_eligibility_rules
Expand Down
6 changes: 0 additions & 6 deletions tests/www/apply/test_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4614,15 +4614,12 @@ def test_as_company(self, _mock):
+ 1 # companies_jobdescription (AcceptForm.__init__)
+ 1 # eligibility_administrativecriteria (/apply/includes/eligibility_diagnosis.html)
+ 1 # asp_country: countries dropdown list.
+ 1 # eligibility_diagnosis.criteria_can_be_certified()
+ 3 # update session with savepoint & release
):
response = self.client.get(self._reverse("apply:hire_confirmation"))
self.assertContains(response, "Déclarer l’embauche de Clara SION")
self.assertContains(response, "Éligible à l’IAE")

birth_country = CountryFranceFactory()
birth_place = CommuneFactory()
hiring_start_at = timezone.localdate()
post_data = {
"hiring_start_at": hiring_start_at.strftime(DuetDatePickerWidget.INPUT_DATE_FORMAT),
Expand All @@ -4638,9 +4635,6 @@ def test_as_company(self, _mock):
"phone": self.job_seeker.phone,
"fill_mode": "ban_api",
"address_for_autocomplete": "0",
# CertifiedCriteriaForm
"birth_country": birth_country.pk,
"birth_place": birth_place.pk,
}
response = self.client.post(
self._reverse("apply:hire_confirmation"),
Expand Down

0 comments on commit e278c93

Please sign in to comment.