summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2017-01-24 09:45:47 +0100
committerLucas Hoffmann <l-m-h@web.de>2017-01-24 20:57:04 +0100
commit30509910985abb1e0018a9e6b2d6973d1894ba9c (patch)
tree2393a1ca20caebbb695bfaa3e2ece1e6649c3570 /tests
parent5cfbbf2a60bdee09a3b018ea70d149ef441fac31 (diff)
Add some tests for ensure_unique_address
Diffstat (limited to 'tests')
-rw-r--r--tests/commands/thread_test.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/commands/thread_test.py b/tests/commands/thread_test.py
new file mode 100644
index 00000000..faf112f9
--- /dev/null
+++ b/tests/commands/thread_test.py
@@ -0,0 +1,36 @@
+# encoding=utf-8
+# Copyright (C) 2017 Lucas Hoffmann
+# This file is released under the GNU GPL, version 3 or a later revision.
+# For further details see the COPYING file
+
+"""Test suite for alot.commands.thread module."""
+from __future__ import absolute_import
+
+import unittest
+
+from alot.commands import thread
+
+
+class Test_ensure_unique_address(unittest.TestCase):
+
+ foo = '"foo" <foo@example.com>'
+ foo2 = '"foo the fanzy" <foo@example.com>'
+ bar = '"bar" <bar@example.com>'
+ baz = '"baz" <baz@example.com>'
+
+ def test_unique_lists_are_unchanged(self):
+ expected = sorted([self.foo, self.bar])
+ actual = thread.ReplyCommand.ensure_unique_address(expected)
+ self.assertListEqual(actual, expected)
+
+ def test_equal_entries_are_detected(self):
+ actual = thread.ReplyCommand.ensure_unique_address(
+ [self.foo, self.bar, self.foo])
+ expected = sorted([self.foo, self.bar])
+ self.assertListEqual(actual, expected)
+
+ def test_same_address_with_different_name_is_detected(self):
+ actual = thread.ReplyCommand.ensure_unique_address(
+ [self.foo, self.foo2])
+ expected = [self.foo2]
+ self.assertListEqual(actual, expected)