diff options
| -rw-r--r-- | tests/test_climat2.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/test_climat2.py b/tests/test_climat2.py index 64345eb..0536646 100644 --- a/tests/test_climat2.py +++ b/tests/test_climat2.py | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | import unittest | 1 | import os |
| 2 | import shutil | ||
| 2 | import subprocess | 3 | import subprocess |
| 4 | import unittest | ||
| 3 | 5 | ||
| 4 | 6 | ||
| 5 | class TestHelp(unittest.TestCase): | 7 | class TestHelp(unittest.TestCase): |
| @@ -14,6 +16,27 @@ class TestHelp(unittest.TestCase): | |||
| 14 | self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) | 16 | self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) |
| 15 | 17 | ||
| 16 | 18 | ||
| 19 | class TestCleanMeta(unittest.TestCase): | ||
| 20 | def test_jpg(self): | ||
| 21 | shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg') | ||
| 22 | |||
| 23 | proc = subprocess.Popen(['./main.py', '--show', './tests/data/clean.jpg'], | ||
| 24 | stdout=subprocess.PIPE) | ||
| 25 | stdout, _ = proc.communicate() | ||
| 26 | self.assertIn(b'Comment: Created with GIMP', stdout) | ||
| 27 | |||
| 28 | proc = subprocess.Popen(['./main.py', './tests/data/clean.jpg'], | ||
| 29 | stdout=subprocess.PIPE) | ||
| 30 | stdout, _ = proc.communicate() | ||
| 31 | |||
| 32 | proc = subprocess.Popen(['./main.py', '--show', './tests/data/clean.jpg.cleaned'], | ||
| 33 | stdout=subprocess.PIPE) | ||
| 34 | stdout, _ = proc.communicate() | ||
| 35 | self.assertNotIn(b'Comment: Created with GIMP', stdout) | ||
| 36 | |||
| 37 | os.remove('./tests/data/clean.jpg') | ||
| 38 | |||
| 39 | |||
| 17 | class TestGetMeta(unittest.TestCase): | 40 | class TestGetMeta(unittest.TestCase): |
| 18 | def test_pdf(self): | 41 | def test_pdf(self): |
| 19 | proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.pdf'], | 42 | proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.pdf'], |
