diff --git a/lemarche/www/auth/tests.py b/lemarche/www/auth/tests.py index d4d8d52bd..589498b15 100644 --- a/lemarche/www/auth/tests.py +++ b/lemarche/www/auth/tests.py @@ -68,6 +68,18 @@ # "id_accept_survey" # not required } +INDIVIDUAL = { + "id_kind": 3, + "first_name": "Prenom", + "last_name": "Nom", + # "phone": "012345678", # not required + "email": "individual@example.com", + "password1": "Erls92#32", + "password2": "Erls92#32", + # "id_accept_rgpd" # required + # "id_accept_survey" # not required +} + def scroll_to_and_click_element(driver, element, click=True, sleep_time=1): """ @@ -231,6 +243,22 @@ def test_partner_submits_signup_form_error(self): # should not submit form (company_name field is required) self.assertEqual(self.driver.current_url, f"{self.live_server_url}{reverse('auth:signup')}") + # TODO: problem with this test + # def test_individual_submits_signup_form_success(self): + # self._complete_form(user_profile=INDIVIDUAL, with_submit=False) + + # # should redirect INDIVIDUAL to home + # self._assert_signup_success(redirect_url=reverse("wagtail_serve", args=("",))) + + def test_individual_submits_signup_form_error(self): + user_profile = INDIVIDUAL.copy() + del user_profile["last_name"] + + self._complete_form(user_profile=user_profile, with_submit=True) + + # should not submit form (last_name field is required) + self.assertEqual(self.driver.current_url, f"{self.live_server_url}{reverse('auth:signup')}") + def test_user_submits_signup_form_with_next_param_success_and_redirect(self): next_url = f"{reverse('siae:search_results')}?kind=ESAT" self._complete_form(