aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2014-12-22 02:40:39 +0100
committerMatěj Cepl <mcepl@cepl.eu>2014-12-22 02:40:39 +0100
commit45552a9cb1ac5433fd2010d1736b41a3393b9b6b (patch)
tree8e0e54e73deced9b3604c59b7f417d3592d9180d /test
parent5b25c51d3a02d49db2c7e33f9b65fad5432219f4 (diff)
downloadpyg-45552a9cb1ac5433fd2010d1736b41a3393b9b6b.tar.gz
pygm2n and mail2news also use email.Parser.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_wlp.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/test_wlp.py b/test/test_wlp.py
index dcb2b78..486fb42 100755
--- a/test/test_wlp.py
+++ b/test/test_wlp.py
@@ -41,30 +41,31 @@ class TestWLP(unittest.TestCase):
class TestM2N(unittest.TestCase):
- def test_m2n(self):
- expected_output = """Newsgroups: pyg.test
+ expected_output = """Newsgroups: pyg.test
From: Pyg <pyg@localhost.com>
-To: this header probably broke RFC, but is frequent.
+To: User <user@localhost.com>
Subject: test
Date: Sun, 1 Feb 2002 16:40:40 +0200
Message-Id: <20001001164040.Aa8326@localhost>
-Content-Type: text/plain; charset=us-ascii
-Mime-Version: 1.0
Return-Path: <pyg@localhost>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
User-Agent: Mutt/1.2.5i
+X-Multiline: this header probably broke RFC, but is frequent.
X-Gateway: pyg The Python Gateway - Mail to News
"""
+
+ def test_m2n(self):
with open('examples/mail') as in_mail:
pid = subprocess.Popen(['./pygm2n', '-TV', '-n', 'pyg.test'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
out, err = pid.communicate(in_mail.read())
- self.assertEqual(out, expected_output)
+ self.assertEqual(out, self.expected_output)
class TestN2M(unittest.TestCase):
- def test_n2m(self):
- expected_output = """Received: from GATEWAY by mitmanek.ceplovi.cz with pyg
+ expected_output = """Received: from GATEWAY by mitmanek.ceplovi.cz with pyg
for <test@example.com> ; Mon Dec 15 17:13:30 2014 (CEST)
From: kame@inwind.it (PYG)
To: test@example.com
@@ -82,6 +83,8 @@ X-NNTP-Posting-Host: pyg.server.tld
Resent-From: sender@example.com
Resent-Sender: sender@example.com
"""
+
+ def test_n2m(self):
env = os.environ
env['PYTHONPATH'] = wlp_lib_path