示例#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', ''))
示例#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', '*****@*****.**'))
示例#3
0
 def test_domain_name_eq_unicode(self):
     addr = account.Address('user', 'éxample.com')
     self.assertEqual(addr, 'user@Éxample.com')
示例#4
0
 def test_domain_name_eq_case(self):
     addr = account.Address('user', 'example.com')
     self.assertEqual(addr, '*****@*****.**')
示例#5
0
 def test_domain_name_ne(self):
     addr = account.Address('user', 'example.com')
     self.assertNotEqual(addr, '*****@*****.**')
示例#6
0
文件: account_test.py 项目: vrs/alot
 def test_domain_name_eq_case_sensitive(self):
     addr = account.Address(u'user', u'example.com', case_sensitive=True)
     self.assertEqual(addr, u'*****@*****.**')
示例#7
0
 def test_ne_unicode_case(self):
     addr = account.Address('ušer', 'example.com')
     self.assertEqual(addr, 'uŠ[email protected]')
示例#8
0
 def test_str(self):
     addr = account.Address('ušer', 'example.com')
     self.assertEqual(str(addr), 'uš[email protected]')
示例#9
0
文件: account_test.py 项目: vrs/alot
 def test_eq_unicode_case(self):
     addr = account.Address(u'UŠer', u'example.com')
     self.assertEqual(addr, u'uš[email protected]')
示例#10
0
文件: account_test.py 项目: vrs/alot
 def test_ne_unicode(self):
     addr = account.Address(u'ušer', u'example.com')
     self.assertNotEqual(addr, u'*****@*****.**')
示例#11
0
文件: account_test.py 项目: vrs/alot
 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)
示例#12
0
文件: account_test.py 项目: vrs/alot
 def test_str(self):
     addr = account.Address(u'ušer', u'example.com')
     self.assertEqual(str(addr), u'uš[email protected]'.encode('utf-8'))
示例#13
0
文件: account_test.py 项目: vrs/alot
 def test_unicode(self):
     addr = account.Address(u'ušer', u'example.com')
     self.assertEqual(unicode(addr), u'uš[email protected]')
示例#14
0
文件: account_test.py 项目: vrs/alot
 def test_constructor_bytes(self):
     with self.assertRaises(AssertionError):
         account.Address(b'username', b'domainname')
示例#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')
示例#16
0
 def test_cmp_empty(self):
     addr = account.Address('user', 'éxample.com')
     self.assertNotEqual(addr, '')
示例#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]')
示例#18
0
 def test_ne_address(self):
     addr = account.Address('ušer', 'example.com')
     addr2 = account.Address('user', 'example.com')
     self.assertNotEqual(addr, addr2)
示例#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)
示例#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)
示例#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
示例#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)")
示例#23
0
文件: account_test.py 项目: vrs/alot
 def test_domain_name_ne_unicode(self):
     addr = account.Address(u'user', u'éxample.com')
     self.assertNotEqual(addr, u'*****@*****.**')