summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-08-03 10:21:11 -0700
committerPatrick Totzke <patricktotzke@gmail.com>2018-08-04 16:21:31 +0100
commit1240eba9cd31e81ea364cdab038685fabb7eab2e (patch)
tree1fdef1fb9de1f8d30e9530506a8cf5df1cd112a7 /tests
parent273f4143626020321b6cf15f94ff0a5ec71d642d (diff)
db/utils: Replace encode_header with Message.add_header
Which appears to be capable of doing all the same things, but is in the stdlib instead of something we hand rolled.
Diffstat (limited to 'tests')
-rw-r--r--tests/db/utils_test.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/db/utils_test.py b/tests/db/utils_test.py
index 7d50d888..6dd23a99 100644
--- a/tests/db/utils_test.py
+++ b/tests/db/utils_test.py
@@ -164,72 +164,6 @@ class TestExtractHeader(unittest.TestCase):
self.assertEqual(actual, expected)
-class TestEncodeHeader(unittest.TestCase):
-
- def test_only_value_is_used_in_output(self):
- actual = utils.encode_header('x-key', 'value')
- expected = email.header.Header('value')
- self.assertEqual(actual, expected)
-
- @unittest.expectedFailure
- def test_unicode_chars_are_encoded(self):
- actual = utils.encode_header('x-key', u'välüe')
- expected = email.header.Header('=?utf-8?b?dsOkbMO8ZQ==?=')
- self.assertEqual(actual, expected)
-
- def test_plain_email_addresses_are_accepted(self):
- address = 'user@example.com'
- actual = utils.encode_header('from', address)
- expected = email.header.Header(address)
- self.assertEqual(actual, expected)
-
- def test_email_addresses_with_realnames_are_accepted(self):
- address = 'someone <user@example.com>'
- actual = utils.encode_header('from', address)
- expected = email.header.Header(address)
- self.assertEqual(actual, expected)
-
- def test_email_addresses_with_empty_realnames_are_treated_like_plain(self):
- address = 'user@example.com'
- empty_realname = '<'+address+'>'
- actual = utils.encode_header('from', empty_realname)
- expected = email.header.Header(address)
- self.assertEqual(str(actual), str(expected))
-
- def test_space_around_email_address_is_striped(self):
- address = ' someone <user@example.com> '
- actual = utils.encode_header('from', address)
- expected = email.header.Header(address.strip())
- self.assertEqual(actual, expected)
-
- def test_spaces_in_user_names_are_accepted(self):
- address = 'some one <user@example.com>'
- actual = utils.encode_header('from', address)
- expected = email.header.Header(address)
- self.assertEqual(actual, expected)
-
- def test_multible_addresses_can_be_given(self):
- addresses = 'one <guy@example.com>, other <guy@example.com>, ' \
- 'last <guy@example.com>'
- actual = utils.encode_header('from', addresses)
- expected = email.header.Header(addresses)
- self.assertEqual(actual, expected)
-
- def test_comma_in_names_are_allowed(self):
- addresses = '"last, first" <guy@example.com>, ' \
- '"name, other" <guy@example.com>'
- actual = utils.encode_header('from', addresses)
- expected = email.header.Header(addresses)
- self.assertEqual(str(actual), str(expected))
-
- def test_utf_8_chars_in_realnames_are_accepted(self):
- address = u'Ümlaut <uemlaut@example.com>'
- actual = utils.encode_header('from', address)
- expected = email.header.Header(
- '=?utf-8?q?=C3=9Cmlaut?= <uemlaut@example.com>')
- self.assertEqual(actual, expected)
-
-
class TestDecodeHeader(unittest.TestCase):
@staticmethod