Add a test case for sending to multiple emails

This commit is contained in:
Neil Martinsen-Burrell 2023-11-09 15:42:55 -06:00
parent a7804b35ea
commit 0e4ba770bf
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184

View file

@ -281,3 +281,23 @@ class TestLogins(TestCase):
# should only be one domain we send email for
self.assertIn("Found 1 transition domains", output)
self.assertTrue("would send email to testuser@gmail.com", output)
def test_send_domain_invitations_two_emails(self):
"""Can send only a single domain invitation email."""
with less_console_noise():
self.run_load_domains()
self.run_transfer_domains()
# these are two email addresses in data/test_contacts.txt
output_stream = StringIO()
# also have to re-point the logging handlers to output_stream
with less_console_noise(output_stream):
call_command("send_domain_invitations", "testuser@gmail.com",
"agustina.wyman7@test.com", stdout=output_stream)
# Check that we had the right numbers in our output
output = output_stream.getvalue()
# should only be one domain we send email for
self.assertIn("Found 2 transition domains", output)
self.assertTrue("would send email to testuser@gmail.com", output)
self.assertTrue("would send email to agustina.wyman7@test.com", output)