-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve when Message objects are created (#5836)
* fix: improve when Message objects are created * test: further improve feedback test * fix: improve and test another form * test: Restructure test infrastructure
- Loading branch information
Showing
2 changed files
with
15 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,7 +122,7 @@ def access_member_url(self, url): | |
self.check_url_status(url, 200) | ||
self.client.logout() | ||
login_testing_unauthorized(self, MEMBER_USER, url) | ||
return self.check_url_status(url, 200) | ||
self.check_url_status(url, 200) | ||
|
||
def access_chair_url(self, url): | ||
login_testing_unauthorized(self, COMMUNITY_USER, url) | ||
|
@@ -134,7 +134,7 @@ def access_secretariat_url(self, url): | |
login_testing_unauthorized(self, COMMUNITY_USER, url) | ||
login_testing_unauthorized(self, CHAIR_USER, url) | ||
login_testing_unauthorized(self, SECRETARIAT_USER, url) | ||
return self.check_url_status(url, 200) | ||
self.check_url_status(url, 200) | ||
|
||
def test_private_index_view(self): | ||
"""Verify private home view""" | ||
|
@@ -599,6 +599,8 @@ def test_public_nominate(self): | |
self.nominate_view(public=True,confirmation=True) | ||
|
||
self.assertEqual(len(outbox), messages_before + 3) | ||
self.assertEqual(Message.objects.count(), 2) | ||
self.assertFalse(Message.objects.filter(subject="Nomination receipt").exists()) | ||
|
||
self.assertEqual('IETF Nomination Information', outbox[-3]['Subject']) | ||
self.assertEqual(self.email_from, outbox[-3]['From']) | ||
|
@@ -625,8 +627,7 @@ def test_public_nominate(self): | |
|
||
def test_private_nominate(self): | ||
self.access_member_url(self.private_nominate_url) | ||
return self.nominate_view(public=False) | ||
self.client.logout() | ||
self.nominate_view(public=False) | ||
|
||
def test_public_nominate_newperson(self): | ||
login_testing_unauthorized(self, COMMUNITY_USER, self.public_nominate_url) | ||
|
@@ -666,13 +667,13 @@ def test_public_nominate_newperson(self): | |
|
||
def test_private_nominate_newperson(self): | ||
self.access_member_url(self.private_nominate_url) | ||
return self.nominate_newperson_view(public=False) | ||
self.client.logout() | ||
self.nominate_newperson_view(public=False, confirmation=True) | ||
self.assertFalse(Message.objects.filter(subject="Nomination receipt").exists()) | ||
|
||
def test_private_nominate_newperson_who_already_exists(self): | ||
EmailFactory(address='[email protected]') | ||
self.access_member_url(self.private_nominate_newperson_url) | ||
return self.nominate_newperson_view(public=False) | ||
self.nominate_newperson_view(public=False) | ||
|
||
def test_public_nominate_with_automatic_questionnaire(self): | ||
nomcom = get_nomcom_by_year(self.year) | ||
|
@@ -844,8 +845,7 @@ def nominate_newperson_view(self, *args, **kwargs): | |
|
||
def test_add_questionnaire(self): | ||
self.access_chair_url(self.add_questionnaire_url) | ||
return self.add_questionnaire() | ||
self.client.logout() | ||
self.add_questionnaire() | ||
|
||
def add_questionnaire(self, *args, **kwargs): | ||
public = kwargs.pop('public', False) | ||
|
@@ -906,6 +906,8 @@ def test_public_feedback(self): | |
# We're interested in the confirmation receipt here | ||
self.assertEqual(len(outbox),3) | ||
self.assertEqual('NomCom comment confirmation', outbox[2]['Subject']) | ||
self.assertEqual(Message.objects.count(), 2) | ||
self.assertFalse(Message.objects.filter(subject="NomCom comment confirmation").exists()) | ||
email_body = get_payload_text(outbox[2]) | ||
self.assertIn(position, email_body) | ||
self.assertNotIn('$', email_body) | ||
|
@@ -920,7 +922,7 @@ def test_public_feedback(self): | |
|
||
def test_private_feedback(self): | ||
self.access_member_url(self.private_feedback_url) | ||
return self.feedback_view(public=False) | ||
self.feedback_view(public=False) | ||
|
||
def feedback_view(self, *args, **kwargs): | ||
public = kwargs.pop('public', True) | ||
|