-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Utilisateurs] nouveau type "Particulier" (#1002)
* New User.kind choice: INDIVIDUAL * Update signup form * Update tests * Fix signup
- Loading branch information
Showing
7 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 4.2.2 on 2023-12-04 14:38 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("stats", "0007_tracker_siae_kind_and_contact_email"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="tracker", | ||
name="user_kind", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("SIAE", "Structure"), | ||
("BUYER", "Acheteur"), | ||
("PARTNER", "Partenaire"), | ||
("INDIVIDUAL", "Particulier"), | ||
("ADMIN", "Administrateur"), | ||
], | ||
max_length=20, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.2 on 2023-12-04 14:38 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("users", "0031_user_rename_buyer_kind_detail_display"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="user", | ||
name="kind", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("SIAE", "Structure"), | ||
("BUYER", "Acheteur"), | ||
("PARTNER", "Partenaire"), | ||
("INDIVIDUAL", "Particulier"), | ||
("ADMIN", "Administrateur"), | ||
], | ||
max_length=20, | ||
verbose_name="Type", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,18 @@ | |
# "id_accept_survey" # not required | ||
} | ||
|
||
INDIVIDUAL = { | ||
"id_kind": 3, | ||
"first_name": "Prenom", | ||
"last_name": "Nom", | ||
# "phone": "012345678", # not required | ||
"email": "[email protected]", | ||
"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( | ||
|