-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest user merge if user with same email address exists
- Loading branch information
1 parent
b4d7d3b
commit fa76484
Showing
4 changed files
with
26 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -272,13 +272,25 @@ def setUpTestData(cls): | |
cls.testuser = baker.make(UserProfile) | ||
cls.url = f"/staff/user/{cls.testuser.pk}/edit" | ||
|
||
def test_questionnaire_edit(self): | ||
def test_user_edit(self): | ||
page = self.app.get(self.url, user=self.manager, status=200) | ||
form = page.forms["user-form"] | ||
form["email"] = "[email protected]" | ||
form.submit() | ||
self.assertTrue(UserProfile.objects.filter(email="[email protected]").exists()) | ||
|
||
def test_user_edit_duplicate_email(self): | ||
second_user = baker.make(UserProfile) | ||
second_user.email = "[email protected]" | ||
second_user.save() | ||
page = self.app.get(self.url, user=self.manager, status=200) | ||
form = page.forms["user-form"] | ||
form["email"] = "[email protected]" | ||
page = form.submit() | ||
self.assertContains( | ||
page, "A user with this email address already exists. You probably want to merge the users." | ||
) | ||
|
||
@patch("evap.staff.forms.remove_user_from_represented_and_ccing_users") | ||
def test_inactive_edit(self, mock_remove): | ||
mock_remove.return_value = ["This text is supposed to be visible on the website."] | ||
|
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