diff options
author | Michael J Gruber <github@grubix.eu> | 2019-06-04 16:30:32 +0200 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2019-08-10 17:33:17 +0100 |
commit | 1bed75d814509f7816c92de665cf6966766c0883 (patch) | |
tree | ccaae259e4d0edad2704751a49acd695fc31d874 /tests | |
parent | a935ab494aba253501758bc59a1f586ad39ed303 (diff) |
ContactsCompletion: use db.utils.formataddr
email.utils.formataddr does more encoding than we need at this point -
headers will be encoded when they get inserted anyway.
Use db.utils.formataddr instead. Fixes #1378
Note that some tests need to be (and are) changed: The expectation of
the old tests was to get a completely escaped result.
Also, add an umlaut test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_completion.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index 79f07e1b..cf94d0eb 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -20,6 +20,7 @@ def _mock_lookup(query): abook = [ ("", "no-real-name@example.com"), ("foo", "foo@example.com"), + ("Ümläut", "umlaut@example.com"), ("comma, person", "comma@example.com"), ("single 'quote' person", "squote@example.com"), ('double "quote" person', "dquote@example.com"), @@ -65,6 +66,11 @@ class AbooksCompleterTest(unittest.TestCase): expected = [("foo <foo@example.com>", 21)] self.assertListEqual(actual, expected) + def test_simple_address_with_umlaut_real_name(self): + actual = self.__class__.example_abook_completer.complete("umlaut", 6) + expected = [("Ümläut <umlaut@example.com>", 27)] + self.assertListEqual(actual, expected) + def test_real_name_with_comma(self): actual = self.__class__.example_abook_completer.complete("comma", 5) expected = [('"comma, person" <comma@example.com>', 35)] @@ -79,13 +85,13 @@ class AbooksCompleterTest(unittest.TestCase): actual = self.__class__.example_abook_completer.complete("dquote", 6) expected = [("", 0)] expected = [ - (r""""double \"quote\" person" <dquote@example.com>""", 46)] + (r"""double "quote" person <dquote@example.com>""", 42)] self._assert_only_one_list_entry(actual, expected) def test_real_name_with_quotes_and_comma(self): actual = self.__class__.example_abook_completer.complete("all", 3) - expected = [(r""""all 'fanzy' \"stuff\" at, once" <all@example.com>""", - 50)] + expected = [(r""""all 'fanzy' "stuff" at, once" <all@example.com>""", + 48)] self._assert_only_one_list_entry(actual, expected) |