summaryrefslogtreecommitdiff
path: root/tests/db
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2019-05-27 18:50:39 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2019-06-02 14:44:13 +0100
commite9f5ff1dde0e28bbdf2b5919af1ac3bf646866f4 (patch)
tree87244d5c6d6ccccaa24195cd4147dedac4c3fac6 /tests/db
parent7a68d4d2cac3f12395696a6eaadce449fa336f52 (diff)
tests: move test for utils.ensure_unique_address
Diffstat (limited to 'tests/db')
-rw-r--r--tests/db/test_utils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/db/test_utils.py b/tests/db/test_utils.py
index 1e230aef..a27bee51 100644
--- a/tests/db/test_utils.py
+++ b/tests/db/test_utils.py
@@ -777,3 +777,30 @@ class TestRemoveCte(unittest.TestCase):
logmsg = 'DEBUG:root:failed to interpret Content-Transfer-Encoding: '\
'"normal"'
self.assertIn(logmsg, cm.output)
+
+
+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 = utils.ensure_unique_address(expected)
+ self.assertListEqual(actual, expected)
+
+ def test_equal_entries_are_detected(self):
+ actual = utils.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 = utils.ensure_unique_address(
+ [self.foo, self.foo2])
+ expected = [self.foo2]
+ self.assertListEqual(actual, expected)
+
+