summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-10-15 09:18:40 +0200
committerAurélien Bompard <aurelien@bompard.org>2013-10-15 09:18:40 +0200
commit2175ec5205b68263b8e241fcf2fe450c5497f1b6 (patch)
treee144ad5d7061bbcfd97315b53e3f068b7c5964c8
parent294333d738ee3c9858913f4b48d9ec0f7ab8b431 (diff)
downloadkittystore-2175ec5205b68263b8e241fcf2fe450c5497f1b6.tar.gz
kittystore-2175ec5205b68263b8e241fcf2fe450c5497f1b6.tar.xz
kittystore-2175ec5205b68263b8e241fcf2fe450c5497f1b6.zip
Prepare an unicode test I don't know yet what to do with
-rw-r--r--kittystore/test/test_storm_store.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/kittystore/test/test_storm_store.py b/kittystore/test/test_storm_store.py
index ba260f7..585001a 100644
--- a/kittystore/test/test_storm_store.py
+++ b/kittystore/test/test_storm_store.py
@@ -6,8 +6,10 @@
import unittest
import email
import datetime
+#from traceback import format_exc
from storm.exceptions import IntegrityError
+#from storm.exceptions import DatabaseError
from mailman.email.message import Message
from kittystore.storm import get_storm_store
@@ -76,9 +78,10 @@ class TestStormStore(unittest.TestCase):
def test_attachment_insert_order(self):
"""Attachments must not be inserted in the DB before the email"""
# Re-activate foreign key support in sqlite
- self.store.db._connection._raw_connection.isolation_level = 'IMMEDIATE'
- self.store.db.execute("PRAGMA foreign_keys = ON")
- self.store.db._connection._raw_connection.execute("PRAGMA foreign_keys = ON")
+ if SettingsModule.KITTYSTORE_URL.startswith("sqlite:"):
+ self.store.db._connection._raw_connection.isolation_level = 'IMMEDIATE'
+ self.store.db.execute("PRAGMA foreign_keys = ON")
+ self.store.db._connection._raw_connection.execute("PRAGMA foreign_keys = ON")
#print "*"*10, list(self.store.db.execute("PRAGMA foreign_keys"))
#self.store = get_storm_store("postgres://kittystore:kittystore@localhost/kittystore_test")
with open(get_test_file("attachment-1.txt")) as email_file:
@@ -203,6 +206,21 @@ class TestStormStore(unittest.TestCase):
self.assertEqual(len(thread), 2)
+ #def test_payload_invalid_unicode(self):
+ # # Python2 won't mind, but PostgreSQL will refuse the data
+ # # http://bugs.python.org/issue9133
+ # msg = Message()
+ # msg["Message-ID"] = "<dummy>"
+ # msg.set_payload("\xed\xa1\xbc") # This is invalid UTF-8
+ # try:
+ # self.store.add_to_list(FakeList("example-list"), msg)
+ # except DatabaseError, e:
+ # print type(e)
+ # print format_exc()
+ # self.fail("Failed to add the message")
+ # self.fail("WIP")
+
+
#def test_non_ascii_payload(self):
# """add_to_list must handle non-ascii messages"""
# with open(get_test_file("non-ascii-payload.txt")) as email_file: