def test_smtpaipheader_addCategory(self): """Test SendGrid SMTP Header with just a category.""" h = SmtpApiHeader() h.set_category("Transactional") # we are testing a string against a string self.assertEqual(h.__str__(), 'X-SMTPAPI: {"category": "Transactional"}')
def test_smtpapiheader_addTo(self): """Test SendGrid SMTP header with recipients""" expected = 'X-SMTPAPI: {"to": ["*****@*****.**", ' + \ '"*****@*****.**", "*****@*****.**"]}' tos = ['*****@*****.**', '*****@*****.**', '*****@*****.**'] h = SmtpApiHeader() h.add_to(tos) # remember we are testing a string against a string self.assertEqual(h.__str__(), expected)
def test_smtpapiheader_setUniqueArgs(self): """Test SendGrid SMTP Header unique args""" expected = 'X-SMTPAPI: {"unique_args": {"testa": 1, "testb": 2}}' h = SmtpApiHeader() h.set_unique_args({'testa': 1, 'testb': 2}) self.assertEqual(h.__str__(), expected)