summaryrefslogtreecommitdiffstats
path: root/kittystore/test
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2012-10-02 12:12:41 +0200
committerAurélien Bompard <aurelien@bompard.org>2012-10-02 12:12:41 +0200
commit4f396b8956fba81221e9c62d8731134343c561d1 (patch)
treea7a190d04704596bb43142f7dc16645901d82bfa /kittystore/test
parentdc3ade6110c49ed647ee5008fe2fef0e9a6d8522 (diff)
downloadkittystore-4f396b8956fba81221e9c62d8731134343c561d1.tar.gz
kittystore-4f396b8956fba81221e9c62d8731134343c561d1.tar.xz
kittystore-4f396b8956fba81221e9c62d8731134343c561d1.zip
Improve charset handling
And store attachment encoding in the database.
Diffstat (limited to 'kittystore/test')
-rw-r--r--kittystore/test/test_scrub.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/kittystore/test/test_scrub.py b/kittystore/test/test_scrub.py
index e694be3..e0e442a 100644
--- a/kittystore/test/test_scrub.py
+++ b/kittystore/test/test_scrub.py
@@ -20,7 +20,7 @@ class TestScrubber(unittest.TestCase):
self.assertEqual(store.add_attachment.call_count, 1)
store.add_attachment.assert_called_with(
'testlist@example.com', '505E5185.5040208@libero.it', 2,
- 'puntogil.vcf', 'text/x-vcard',
+ 'puntogil.vcf', 'text/x-vcard', "utf-8",
'begin:vcard\r\nfn:gil\r\nn:;gil\r\nversion:2.1\r\n'
'end:vcard\r\n\r\n')
self.assertEqual(contents,
@@ -38,7 +38,7 @@ class TestScrubber(unittest.TestCase):
self.assertEqual(store.add_attachment.call_count, 1)
store.add_attachment.assert_called_with(
'testlist@example.com', '50619B7A.2030404@thelounge.net', 3,
- 'signature.asc', 'application/pgp-signature',
+ 'signature.asc', 'application/pgp-signature', None,
'-----BEGIN PGP SIGNATURE-----\r\nVersion: GnuPG v1.4.12 '
'(GNU/Linux)\r\nComment: Using GnuPG with Mozilla - '
'http://www.enigmail.net/\r\n\r\niEYEARECAAYFAlBhm3oACgkQhmBj'
@@ -59,15 +59,15 @@ class TestScrubber(unittest.TestCase):
self.assertEqual(store.add_attachment.call_count, 2)
args_1, args_2 = store.add_attachment.call_args_list
# HTML part
- self.assertEqual(args_1[0][0:5], ("testlist@example.com",
+ self.assertEqual(args_1[0][0:6], ("testlist@example.com",
"CACec3Lup8apbhUMcm_Ktn1dPxx4eWr2y1RV7ZSYhy0tzmjSrgQ@mail.gmail.com",
- 3, "attachment.html", "text/html"))
- self.assertEqual(len(args_1[0][5]), 3134)
+ 3, "attachment.html", "text/html", "iso-8859-1"))
+ self.assertEqual(len(args_1[0][6]), 3134)
# Image attachment
- self.assertEqual(args_2[0][0:5], ("testlist@example.com",
+ self.assertEqual(args_2[0][0:6], ("testlist@example.com",
"CACec3Lup8apbhUMcm_Ktn1dPxx4eWr2y1RV7ZSYhy0tzmjSrgQ@mail.gmail.com",
- 4, "GeoffreyRoucourt.jpg", "image/jpeg"))
- self.assertEqual(len(args_2[0][5]), 282180)
+ 4, "GeoffreyRoucourt.jpg", "image/jpeg", None))
+ self.assertEqual(len(args_2[0][6]), 282180)
# Scrubbed content
self.assertEqual(contents, u"This is a test message\r\n")
@@ -80,10 +80,10 @@ class TestScrubber(unittest.TestCase):
self.assertEqual(store.add_attachment.call_count, 1)
args = store.add_attachment.call_args[0]
# HTML part
- self.assertEqual(args[0:5], ("testlist@example.com",
+ self.assertEqual(args[0:6], ("testlist@example.com",
"016001cd9b3b$b71efed0$255cfc70$@fr",
- 2, "attachment.html", "text/html"))
- self.assertEqual(len(args[5]), 2723)
+ 2, "attachment.html", "text/html", "iso-8859-1"))
+ self.assertEqual(len(args[6]), 2723)
# Scrubbed content
self.assertEqual(contents,
u"This is a test message\r\n"