diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2023-05-26 15:25:07 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2023-05-26 15:25:07 +0200 |
commit | aaccabcd76f6726563ec5207b5e3eb466a46cee9 (patch) | |
tree | 18ca338c79e38739a9a13e3f3fa660b1ac14fadc /test | |
parent | 12cd578201bffe69c3f4d88081d8698d0c79d23f (diff) | |
download | pyg-aaccabcd76f6726563ec5207b5e3eb466a46cee9.tar.gz |
Brief discussion with pylint.
Diffstat (limited to 'test')
-rwxr-xr-x | test/test_pyg.py | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/test/test_pyg.py b/test/test_pyg.py index 6777bd2..69a9eeb 100755 --- a/test/test_pyg.py +++ b/test/test_pyg.py @@ -1,6 +1,5 @@ #!/usr/bin/python import re -import subprocess import unittest import mail2news @@ -9,31 +8,24 @@ import news2mail @unittest.skip('not ready') class TestM2N(unittest.TestCase): - expected_output = """Newsgroups: pyg.test + expected_output = f"""Newsgroups: pyg.test From: Pyg <pyg@localhost.com> To: User <user@localhost.com> Subject: test -Date: Sun, 1 Feb 2002 16:40:40 +0200 +Date: Fri, 01 Feb 2002 16:40:40 +0200 Message-Id: <20001001164040.Aa8326@localhost> Return-Path: <pyg@localhost> Mime-Version: 1.0 -Content-Type: text/plain; charset=us-ascii +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 %s %s +X-Gateway: pyg {mail2news.__version__} {mail2news.__description__} one line test -""" % (mail2news.__version__, mail2news.__description__) +""" def test_m2n(self): - # with open('examples/mail') as in_mail: - # pid = subprocess.Popen([sys.executable, - # 'src/mail2news.py', '-Tv', '-n', 'pyg.test'], - # stdin=subprocess.PIPE, - # stdout=subprocess.PIPE, - # universal_newlines=True) - # out, _ = pid.communicate(in_mail.read()) out = mail2news.main(['-T', '-v', '-i', 'examples/mail', '-n', 'pyg.test']) self.assertEqual(out, self.expected_output) @@ -41,7 +33,7 @@ one line test @unittest.skip('not ready') class TestN2M(unittest.TestCase): - expected_output = """Received: from GATEWAY by mitmanek.ceplovi.cz with pyg + expected_output = f"""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 @@ -54,23 +46,13 @@ Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Trace: pyg.server.tld 960672047 927 192.168.1.2 (10 Jun 2000 21:20:47 GMT) X-Newsgroups: local.moderated -X-Gateway: pyg %s %s +X-Gateway: pyg {mail2news.__version__} {mail2news.__description__} X-NNTP-Posting-Host: pyg.server.tld Resent-From: sender@example.com Resent-Sender: sender@example.com -""" % (mail2news.__version__, mail2news.__description__) +""" def test_n2m(self): - # with open('examples/articletest.accepted') as in_mail: - # pid = subprocess.Popen([sys.executable, 'src/news2mail.py', '-Tvt', 'test@example.com', - # '-s', 'sender@example.com', - # '-w', 'examples/whitelist.example'], - # stdin=subprocess.PIPE, - # stdout=subprocess.PIPE, - # universal_newlines=True) - # in_message = in_mail.read().replace('pyg@pyg.server.tld', - # 'kame@inwind.it') - # out, err = pid.communicate(in_message) out = news2mail.main(['-T', '-v', '-t', 'test@example.com', '-s', 'sender@example.com', '-w', 'examples/whitelist.example']) |