Beispiel #1
0
    def test_new_job_seeker_is_redirected_after_welcoming_tour_test(self):
        siae = SiaeWithMembershipFactory()
        job_seeker = JobSeekerFactory.build()

        # First signup step: job seeker NIR.
        next_to = reverse("apply:start", kwargs={"siae_pk": siae.pk})
        url = f"{reverse('signup:job_seeker_nir')}?next={next_to}"
        self.client.post(url, {"nir": job_seeker.nir, "confirm": 1})

        # Second signup step: job seeker credentials.
        url = f"{reverse('signup:job_seeker')}?next={next_to}"
        post_data = {
            "first_name": job_seeker.first_name,
            "last_name": job_seeker.last_name,
            "email": job_seeker.email,
            "password1": PASSWORD,
            "password2": PASSWORD,
        }
        response = self.client.post(url, data=post_data)
        response = self.verify_email(job_seeker.email, response.wsgi_request)

        # The user should not be redirected to the welcoming path if he wanted to perform
        # another action before signing up.
        self.assertNotIn(response.wsgi_request.path,
                         reverse("welcoming_tour:index"))

        # The user is redirected to "apply:step_check_job_seeker_info"
        # as birthdate and pole_emploi_id are missing from the signup form.
        # This is a valid behavior that may change in the future so
        # let's avoid too specific tests.
        self.assertTrue(response.wsgi_request.path.startswith("/apply"))

        content = mail.outbox[0].body
        self.assertIn(next_to, content)
Beispiel #2
0
    def test_new_job_seeker_sees_welcoming_tour_test(self):
        job_seeker = JobSeekerFactory.build()
        self.email = job_seeker.email

        # First signup step: job seeker NIR.
        url = reverse("signup:job_seeker_nir")
        self.client.post(url, {"nir": job_seeker.nir, "confirm": 1})

        # Second signup step: job seeker credentials.
        url = reverse("signup:job_seeker")
        post_data = {
            "first_name": job_seeker.first_name,
            "last_name": job_seeker.last_name,
            "email": job_seeker.email,
            "password1": PASSWORD,
            "password2": PASSWORD,
        }
        response = self.client.post(url, data=post_data)
        response = self.verify_email(response.wsgi_request)

        # User should be redirected to the welcoming tour as he just signed up
        self.assertEqual(response.wsgi_request.path,
                         reverse("welcoming_tour:index"))
        self.assertTemplateUsed(response, "welcoming_tour/job_seeker.html")