summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2017-01-25 11:47:45 +0100
committerLucas Hoffmann <l-m-h@web.de>2017-01-25 11:47:45 +0100
commitba1b49936fa9b9bb8563e8d1ea13eec10117acd6 (patch)
tree151f2e9acb2a4ecc9765589ee4d00ba9897fc1dc /tests
parent74205e663f52e3cfc68ab41283633bc99bac9755 (diff)
Add tests for ReplyCommand.clear_my_address
Diffstat (limited to 'tests')
-rw-r--r--tests/commands/thread_test.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/commands/thread_test.py b/tests/commands/thread_test.py
index 82e57405..bb8514d6 100644
--- a/tests/commands/thread_test.py
+++ b/tests/commands/thread_test.py
@@ -34,3 +34,49 @@ class Test_ensure_unique_address(unittest.TestCase):
[self.foo, self.foo2])
expected = [self.foo2]
self.assertListEqual(actual, expected)
+
+
+class TestClearMyAddress(unittest.TestCase):
+
+ me1 = 'me@example.com'
+ me2 = 'ME@example.com'
+ me_named = 'alot team <me@example.com>'
+ you = 'you@example.com'
+ named = 'somebody you know <somebody@example.com>'
+ imposter = 'alot team <imposter@example.com>'
+ mine = [me1, me2]
+
+ def test_empty_input_returns_empty_list(self):
+ self.assertListEqual(
+ thread.ReplyCommand.clear_my_address(self.mine, []), [])
+
+ def test_only_my_emails_result_in_empty_list(self):
+ expected = []
+ actual = thread.ReplyCommand.clear_my_address(self.mine,
+ self.mine+[self.me_named])
+ self.assertListEqual(actual, expected)
+
+ def test_other_emails_are_untouched(self):
+ input_ = [self.you, self.me1, self.me_named, self.named]
+ expected = [self.you, self.named]
+ actual = thread.ReplyCommand.clear_my_address(self.mine, input_)
+ self.assertListEqual(actual, expected)
+
+ def test_case_matters(self):
+ expected = [self.me1]
+ mine = [self.me2]
+ actual = thread.ReplyCommand.clear_my_address(mine, expected)
+ self.assertListEqual(actual, expected)
+
+ def test_same_address_with_different_real_name_is_removed(self):
+ input_ = [self.me_named, self.you]
+ mine = [self.me1]
+ expected = [self.you]
+ actual = thread.ReplyCommand.clear_my_address(mine, input_)
+ self.assertListEqual(actual, expected)
+
+ def test_real_name_is_never_considered(self):
+ expected = [self.imposter]
+ mine = 'alot team'
+ actual = thread.ReplyCommand.clear_my_address(mine, expected)
+ self.assertListEqual(actual, expected)