from nose.tools import * from salmon.testing import * from salmon.mail import MailRequest, MailResponse from app.model import archive, mailinglist import simplejson as json import shutil queue_path = archive.store_path('test.list', 'queue') json_path = archive.store_path('test.list', 'json') def setup(): clear_queue(queue_path) shutil.rmtree(json_path) def teardown(): clear_queue(queue_path) shutil.rmtree(json_path) def test_archive_enqueue(): msg = MailResponse(From=u'"p\xf6stal Zed" <*****@*****.**>', To="*****@*****.**", Subject="test message", Body="This is a test.") archive.enqueue('test.list', msg) archived = delivered('zedshaw', to_queue=queue(queue_path)) assert archived, "Didn't get archived." as_string = str(archived)
from nose.tools import * from lamson.testing import * from lamson.mail import MailRequest, MailResponse from app.model import archive, mailinglist import simplejson as json import shutil queue_path = archive.store_path('test.list', 'queue') json_path = archive.store_path('test.list', 'json') def setup(): clear_queue(queue_path) shutil.rmtree(json_path) def teardown(): clear_queue(queue_path) shutil.rmtree(json_path) def test_archive_enqueue(): msg = MailResponse(From=u'"p\xf6stal Zed" <*****@*****.**>', To="*****@*****.**", Subject="test message", Body="This is a test.") archive.enqueue('test.list', msg) archived = delivered('zedshaw', to_queue=queue(queue_path)) assert archived, "Didn't get archived." as_string = str(archived) assert '-AT-' in str(archived), "Didn't get obfuscated" assert '<' in as_string and '"' in as_string and '>' in as_string, "Unicode email screwed up."