Exemplo n.º 1
0
 def test_get_author_no_name(self):
     """Message._from is set to 'Unkown' if there is no relavent header and
     the message is not a draft.
     """
     acc = mock.Mock()
     acc.address = account.Address(u'user', u'example.com')
     acc.realname = u'User Name'
     with mock.patch('alot.db.message.settings.get_accounts',
                     mock.Mock(return_value=[acc])):
         msg = message.Message(mock.Mock(), MockNotmuchMessage())
     self.assertEqual(msg.get_author(), ('Unknown', ''))
Exemplo n.º 2
0
 def test_get_author_no_name_draft(self):
     """Message._from is populated from the default account if the draft tag
     is present.
     """
     acc = mock.Mock()
     acc.address = account.Address(u'user', u'example.com')
     acc.realname = u'User Name'
     with mock.patch('alot.db.message.settings.get_accounts',
                     mock.Mock(return_value=[acc])):
         msg = message.Message(mock.Mock(),
                               MockNotmuchMessage(tags=['draft']))
     self.assertEqual(msg.get_author(), ('User Name', '*****@*****.**'))
Exemplo n.º 3
0
 def test_domain_name_eq_unicode(self):
     addr = account.Address('user', 'éxample.com')
     self.assertEqual(addr, 'user@Éxample.com')
Exemplo n.º 4
0
 def test_domain_name_eq_case(self):
     addr = account.Address('user', 'example.com')
     self.assertEqual(addr, '*****@*****.**')
Exemplo n.º 5
0
 def test_domain_name_ne(self):
     addr = account.Address('user', 'example.com')
     self.assertNotEqual(addr, '*****@*****.**')
Exemplo n.º 6
0
 def test_domain_name_eq_case_sensitive(self):
     addr = account.Address(u'user', u'example.com', case_sensitive=True)
     self.assertEqual(addr, u'*****@*****.**')
Exemplo n.º 7
0
 def test_ne_unicode_case(self):
     addr = account.Address('ušer', 'example.com')
     self.assertEqual(addr, 'uŠ[email protected]')
Exemplo n.º 8
0
 def test_str(self):
     addr = account.Address('ušer', 'example.com')
     self.assertEqual(str(addr), 'uš[email protected]')
Exemplo n.º 9
0
 def test_eq_unicode_case(self):
     addr = account.Address(u'UŠer', u'example.com')
     self.assertEqual(addr, u'uš[email protected]')
Exemplo n.º 10
0
 def test_ne_unicode(self):
     addr = account.Address(u'ušer', u'example.com')
     self.assertNotEqual(addr, u'*****@*****.**')
Exemplo n.º 11
0
 def test_eq_address(self):
     addr = account.Address(u'ušer', u'example.com')
     addr2 = account.Address(u'ušer', u'example.com')
     self.assertEqual(addr, addr2)
Exemplo n.º 12
0
 def test_str(self):
     addr = account.Address(u'ušer', u'example.com')
     self.assertEqual(str(addr), u'uš[email protected]'.encode('utf-8'))
Exemplo n.º 13
0
 def test_unicode(self):
     addr = account.Address(u'ušer', u'example.com')
     self.assertEqual(unicode(addr), u'uš[email protected]')
Exemplo n.º 14
0
 def test_constructor_bytes(self):
     with self.assertRaises(AssertionError):
         account.Address(b'username', b'domainname')
Exemplo n.º 15
0
 def test_domain_name_eq_unicode_sensitive(self):
     addr = account.Address('user', 'éxample.com', case_sensitive=True)
     self.assertEqual(addr, 'user@Éxample.com')
Exemplo n.º 16
0
 def test_cmp_empty(self):
     addr = account.Address('user', 'éxample.com')
     self.assertNotEqual(addr, '')
Exemplo n.º 17
0
 def test_eq_unicode_case_sensitive(self):
     addr = account.Address('UŠer', 'example.com', case_sensitive=True)
     self.assertNotEqual(addr, 'uš[email protected]')
Exemplo n.º 18
0
 def test_ne_address(self):
     addr = account.Address('ušer', 'example.com')
     addr2 = account.Address('user', 'example.com')
     self.assertNotEqual(addr, addr2)
Exemplo n.º 19
0
 def test_eq_address_case_sensitive(self):
     addr = account.Address('UŠer', 'example.com', case_sensitive=True)
     addr2 = account.Address('ušer', 'example.com')
     self.assertNotEqual(addr, addr2)
Exemplo n.º 20
0
 def test_eq_address_case(self):
     addr = account.Address('UŠer', 'example.com')
     addr2 = account.Address('ušer', 'example.com')
     self.assertEqual(addr, addr2)
Exemplo n.º 21
0
 def test_ne_str(self):
     addr = account.Address('user', 'example.com', case_sensitive=True)
     with self.assertRaises(TypeError):
         addr != 1  # pylint: disable=pointless-statement
Exemplo n.º 22
0
 def test_repr(self):
     addr = account.Address('user', 'example.com', case_sensitive=True)
     self.assertEqual(
         repr(addr), "Address('user', 'example.com', case_sensitive=True)")
Exemplo n.º 23
0
 def test_domain_name_ne_unicode(self):
     addr = account.Address(u'user', u'éxample.com')
     self.assertNotEqual(addr, u'*****@*****.**')