diff options
| author | jvoisin | 2018-07-30 22:54:41 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-30 22:54:41 +0200 |
| commit | b5a9520a607bd368fdf538c61914e15ba6b1b8e3 (patch) | |
| tree | 211580d4a0745798aea5e63fa11616272156d101 /tests/test_climat2.py | |
| parent | a1257c538be63f1c8119e4e2f9116dccfd91d8b7 (diff) | |
Add a cli-related test
Diffstat (limited to 'tests/test_climat2.py')
| -rw-r--r-- | tests/test_climat2.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_climat2.py b/tests/test_climat2.py index 99f9b9c..e65e47f 100644 --- a/tests/test_climat2.py +++ b/tests/test_climat2.py | |||
| @@ -44,6 +44,33 @@ class TestReturnValue(unittest.TestCase): | |||
| 44 | self.assertEqual(0, ret) | 44 | self.assertEqual(0, ret) |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | class TestCleanFolder(unittest.TestCase): | ||
| 48 | def test_jpg(self): | ||
| 49 | os.mkdir('./tests/data/folder/') | ||
| 50 | shutil.copy('./tests/data/dirty.jpg', './tests/data/folder/clean1.jpg') | ||
| 51 | shutil.copy('./tests/data/dirty.jpg', './tests/data/folder/clean2.jpg') | ||
| 52 | |||
| 53 | proc = subprocess.Popen(['./mat2', '--show', './tests/data/folder/'], | ||
| 54 | stdout=subprocess.PIPE) | ||
| 55 | stdout, _ = proc.communicate() | ||
| 56 | self.assertIn(b'Comment: Created with GIMP', stdout) | ||
| 57 | |||
| 58 | proc = subprocess.Popen(['./mat2', './tests/data/folder/'], | ||
| 59 | stdout=subprocess.PIPE) | ||
| 60 | stdout, _ = proc.communicate() | ||
| 61 | |||
| 62 | os.remove('./tests/data/folder/clean1.jpg') | ||
| 63 | os.remove('./tests/data/folder/clean2.jpg') | ||
| 64 | |||
| 65 | proc = subprocess.Popen(['./mat2', '--show', './tests/data/folder/'], | ||
| 66 | stdout=subprocess.PIPE) | ||
| 67 | stdout, _ = proc.communicate() | ||
| 68 | self.assertNotIn(b'Comment: Created with GIMP', stdout) | ||
| 69 | |||
| 70 | shutil.rmtree('./tests/data/folder/') | ||
| 71 | |||
| 72 | |||
| 73 | |||
| 47 | class TestCleanMeta(unittest.TestCase): | 74 | class TestCleanMeta(unittest.TestCase): |
| 48 | def test_jpg(self): | 75 | def test_jpg(self): |
| 49 | shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg') | 76 | shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg') |
