diff options
author | vrs <none> | 2018-12-08 23:11:24 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2018-12-10 10:25:49 +0000 |
commit | f7c5b841568886be64695a14f341c4c7c58b3fba (patch) | |
tree | 415ff08c0d7a9b5e695c4c9e26ede7e000db1eba /tests/account_test.py | |
parent | b981bfe0c61d9aa55652b4b0a01b846aaa9c993a (diff) |
match addresses against accounts, not address lists
fixes #1230, fixes an unfiled bug in clear_my_address()
Diffstat (limited to 'tests/account_test.py')
-rw-r--r-- | tests/account_test.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/account_test.py b/tests/account_test.py index 9f6287be..9d0ac125 100644 --- a/tests/account_test.py +++ b/tests/account_test.py @@ -32,20 +32,30 @@ class _AccountTestClass(account.Account): class TestAccount(unittest.TestCase): """Tests for the Account class.""" - def test_get_address(self): + def test_matches_address(self): """Tests address without aliases.""" acct = _AccountTestClass(address="foo@example.com") - self.assertListEqual(acct.get_addresses(), ['foo@example.com']) + self.assertTrue(acct.matches_address(u"foo@example.com")) + self.assertFalse(acct.matches_address(u"bar@example.com")) - def test_get_address_with_aliases(self): + def test_matches_address_with_aliases(self): """Tests address with aliases.""" acct = _AccountTestClass(address="foo@example.com", aliases=['bar@example.com']) - self.assertListEqual(acct.get_addresses(), - ['foo@example.com', 'bar@example.com']) + self.assertTrue(acct.matches_address(u"foo@example.com")) + self.assertTrue(acct.matches_address(u"bar@example.com")) + self.assertFalse(acct.matches_address(u"baz@example.com")) + + def test_matches_address_with_regex_aliases(self): + """Tests address with regex aliases.""" + acct = _AccountTestClass(address=u"foo@example.com", + alias_regexp=r'to\+.*@example.com') + self.assertTrue(acct.matches_address(u"to+foo@example.com")) + self.assertFalse(acct.matches_address(u"to@example.com")) + def test_deprecated_encrypt_by_default(self): - """Tests that depreacted values are still accepted.""" + """Tests that deprecated values are still accepted.""" for each in ['true', 'yes', '1']: acct = _AccountTestClass(address='foo@example.com', encrypt_by_default=each) |