-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7764e75
commit bf6feaf
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
__all__ = [ | ||
'AttachmentTests', | ||
'CommandLineTests', | ||
'OleWriterEditingTests', | ||
'OleWriterExportTests', | ||
'PropTests', | ||
'ValidationTests', | ||
] | ||
|
||
from .validation_tests import ValidationTests | ||
from .attachment_tests import AttachmentTests | ||
from .cmd_line_tests import CommandLineTests | ||
from .ole_writer_tests import OleWriterEditingTests, OleWriterExportTests | ||
from .prop_tests import PropTests | ||
from .validation_tests import ValidationTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
__all__ = [ | ||
'CommandLineTests', | ||
] | ||
|
||
|
||
import pathlib | ||
import subprocess | ||
import sys | ||
import unittest | ||
|
||
from .constants import TEST_FILE_DIR, USER_TEST_DIR | ||
|
||
|
||
class CommandLineTests(unittest.TestCase): | ||
def testStdin(self, testFileDir = TEST_FILE_DIR): | ||
for path in testFileDir.glob('*.msg'): | ||
# First, let's do the file on the disk. | ||
process = subprocess.Popen([sys.executable, '-m', 'extract_msg', '--dump-stdout', str(path)], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE) | ||
# Wait for the process to return data. | ||
stdout1, stderr1 = process.communicate() | ||
|
||
# Now, do the same thing with stdin. | ||
process = subprocess.Popen([sys.executable, '-m', 'extract_msg', '-s', '--dump-stdout'], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE) | ||
with open(path, 'rb') as f: | ||
stdout2, stderr2 = process.communicate(f.read()) | ||
|
||
# Now, compare the two. | ||
with self.subTest(path): | ||
self.assertEqual(stdout1, stdout2) | ||
self.assertEqual(stderr1, stderr2) | ||
|
||
@unittest.skipIf(USER_TEST_DIR is None, 'User test files not defined.') | ||
def testUserStdin(self): | ||
self.testStdin(USER_TEST_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters