diff --git a/ietf/nomcom/forms.py b/ietf/nomcom/forms.py index 20bf508e8e..ad7bc67c23 100644 --- a/ietf/nomcom/forms.py +++ b/ietf/nomcom/forms.py @@ -343,7 +343,7 @@ def save(self, commit=True): 'year': self.nomcom.year(), } path = nomcom_template_path + NOMINATION_RECEIPT_TEMPLATE - send_mail(None, to_email, from_email, subject, path, context, cc=cc) + send_mail(None, to_email, from_email, subject, path, context, cc=cc, copy=False, save=False) return nomination @@ -458,7 +458,7 @@ def save(self, commit=True): 'year': self.nomcom.year(), } path = nomcom_template_path + NOMINATION_RECEIPT_TEMPLATE - send_mail(None, to_email, from_email, subject, path, context, cc=cc) + send_mail(None, to_email, from_email, subject, path, context, cc=cc, copy=False, save=False) return nomination @@ -551,7 +551,7 @@ def save(self, commit=True): } path = nomcom_template_path + FEEDBACK_RECEIPT_TEMPLATE # TODO - make the thing above more generic - send_mail(None, to_email, from_email, subject, path, context, cc=cc, copy=False) + send_mail(None, to_email, from_email, subject, path, context, cc=cc, copy=False, save=False) class Meta: model = Feedback diff --git a/ietf/nomcom/tests.py b/ietf/nomcom/tests.py index dff5fb9500..216984776c 100644 --- a/ietf/nomcom/tests.py +++ b/ietf/nomcom/tests.py @@ -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='nominee@example.com') 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)