-
Notifications
You must be signed in to change notification settings - Fork 146
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 (#2065)
Co-authored-by: Niklas Mohrin <[email protected]> Co-authored-by: Richard Ebeling <[email protected]>
- Loading branch information
1 parent
431077a
commit ec9a65f
Showing
4 changed files
with
27 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
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,12 +272,22 @@ 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"] = "lfo9e7bmxp1xi@institution.example.com" | ||
form["email"] = "test@institution.example.com" | ||
form.submit() | ||
self.assertTrue(UserProfile.objects.filter(email="[email protected]").exists()) | ||
self.assertTrue(UserProfile.objects.filter(email="[email protected]").exists()) | ||
|
||
def test_user_edit_duplicate_email(self): | ||
second_user = baker.make(UserProfile, email="[email protected]") | ||
page = self.app.get(self.url, user=self.manager, status=200) | ||
form = page.forms["user-form"] | ||
form["email"] = second_user.email | ||
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): | ||
|
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