def test_mail_format(self): contact = Contact(email='*****@*****.**') self.assertEquals(contact.mail_format(), '*****@*****.**') contact = Contact(email='*****@*****.**', full_name='Toto') self.assertEquals(contact.mail_format(), 'Toto <*****@*****.**>') contact = Contact(email='*****@*****.**', full_name='Toto Titi') self.assertEquals(contact.mail_format(), 'Titi Toto <*****@*****.**>')
def test_vcard_format(self): contact = Contact(email='*****@*****.**', full_name='Toto Titi') self.assertEquals(contact.vcard_format(), 'BEGIN:VCARD\r\nVERSION:3.0\r\n' \ 'EMAIL;TYPE=INTERNET:[email protected]\r\nFN:Toto Titi\r\n' \ 'N:Titi Toto;;;\r\nEND:VCARD\r\n')
def test_unique(self): Contact(email='*****@*****.**').save() self.assertRaises(IntegrityError, Contact(email='*****@*****.**').save)