Exemple #1
0
 def test_contacts_with_weight_type(self):
     c = [
         EmailAddress("emailname", "emailaddr"),
         EmailAddress("emailname", "emailaddr", weight=50),
         PhoneNumber("phonename", "phonenum"),
     ]
     r = Recipient("recipientname", contacts=c)
     self.assertEqual(list(r.contacts(of_type=EmailAddress)), [c[1]])
Exemple #2
0
 def test_contacts_with_weight_all(self):
     c = [
         EmailAddress("emailname", "emailaddr"),
         EmailAddress("emailname", "emailaddr", weight=50),
         PhoneNumber("phonename", "phonenum"),
     ]
     r = Recipient("recipientname", contacts=c)
     self.assertEqual(list(r.contacts(include_all=True)), [c[1], c[0], c[2]])
Exemple #3
0
 def test_contacts_having(self):
     c = [PhoneNumber("phonename", "phonenum", sms_ok=False), PhoneNumber("phonename", "phonenum", sms_ok=True)]
     r = Recipient("recipientname", contacts=c)
     self.assertEqual(list(r.contacts(sms_ok=True)), [c[1]])
Exemple #4
0
 def test_contacts_by_type(self):
     c = [EmailAddress("emailname", "emailaddr"), PhoneNumber("phonename", "phonenum")]
     r = Recipient("recipientname", contacts=c)
     self.assertEqual(list(r.contacts(of_type=EmailAddress)), [c[0]])
Exemple #5
0
 def test_less_simple_recipient(self):
     c = [EmailAddress("emailname", "emailaddr"), PhoneNumber("phonename", "phonenum")]
     r = Recipient("recipientname", contacts=c)
     self.assertEqual(list(r.contacts()), c)
Exemple #6
0
 def test_simple_recipient(self):
     c = [EmailAddress("emailname", "emailaddr")]
     r = Recipient("recipientname", contacts=c)
     self.assertEqual(list(r.contacts()), c)
Exemple #7
0
 def test_recipient_defaults(self):
     r = Recipient("recipientname")
     self.assertEqual(list(r.contacts()), [])