예제 #1
0
 def test_accept_job_application_sent_by_prescriber(self):
     job_application = JobApplicationSentByPrescriberOrganizationFactory(
         state=JobApplicationWorkflow.STATE_PROCESSING)
     # A valid Pôle emploi ID should trigger an automatic approval delivery.
     self.assertNotEqual(job_application.job_seeker.pole_emploi_id, "")
     job_application.accept(user=job_application.to_siae.members.first())
     self.assertIsNotNone(job_application.approval)
     self.assertTrue(job_application.approval_number_sent_by_email)
     self.assertEqual(job_application.approval_delivery_mode,
                      job_application.APPROVAL_DELIVERY_MODE_AUTOMATIC)
     # Check sent email.
     self.assertEqual(len(mail.outbox), 2)
     self.assertIn("Candidature acceptée", mail.outbox[0].subject)
     self.assertIn("Délivrance d'un PASS IAE pour", mail.outbox[1].subject)
예제 #2
0
 def test_accept_job_application_sent_by_prescriber_with_approval_in_waiting_period(
         self):
     user = JobSeekerFactory()
     # Ended 1 year ago.
     end_at = datetime.date.today() - relativedelta(years=1)
     start_at = end_at - relativedelta(years=2)
     approval = PoleEmploiApprovalFactory(
         pole_emploi_id=user.pole_emploi_id,
         birthdate=user.birthdate,
         start_at=start_at,
         end_at=end_at)
     self.assertTrue(approval.is_in_waiting_period)
     job_application = JobApplicationSentByPrescriberOrganizationFactory(
         job_seeker=user, state=JobApplicationWorkflow.STATE_PROCESSING)
     with self.assertRaises(xwf_models.AbortTransition):
         job_application.accept(
             user=job_application.to_siae.members.first())
예제 #3
0
 def test_job_application_sent_by_prescriber_organization_factory(self):
     job_application = JobApplicationSentByPrescriberOrganizationFactory()
     self.assertEqual(job_application.sender_kind,
                      JobApplication.SENDER_KIND_PRESCRIBER)
     self.assertNotEqual(job_application.job_seeker, job_application.sender)
     sender = job_application.sender
     sender_prescriber_organization = job_application.sender_prescriber_organization
     self.assertIn(sender, sender_prescriber_organization.members.all())
     self.assertFalse(sender_prescriber_organization.is_authorized)
예제 #4
0
    def test_is_sent_by_authorized_prescriber(self):
        job_application = JobApplicationSentByJobSeekerFactory()
        self.assertFalse(job_application.is_sent_by_authorized_prescriber)

        job_application = JobApplicationSentByPrescriberFactory()
        self.assertFalse(job_application.is_sent_by_authorized_prescriber)

        job_application = JobApplicationSentByPrescriberOrganizationFactory()
        self.assertFalse(job_application.is_sent_by_authorized_prescriber)

        job_application = JobApplicationSentBySiaeFactory()
        self.assertFalse(job_application.is_sent_by_authorized_prescriber)

        job_application = JobApplicationSentByAuthorizedPrescriberOrganizationFactory()
        self.assertTrue(job_application.is_sent_by_authorized_prescriber)