diff options
| author | jvoisin | 2018-04-16 23:20:21 +0200 |
|---|---|---|
| committer | jvoisin | 2018-04-16 23:20:21 +0200 |
| commit | ecb199b4a6a2f54b84237d4f74c145a051c4c08b (patch) | |
| tree | 1692db908b0958a2bfbe2203535beeda7ba364f9 /tests/test_climat2.py | |
| parent | e34bc19f7126b80764a4c8747a7a2a1636289396 (diff) | |
Add a cli-related test
Since I didn't notice that it was broken
until c5f51345029440ab80cfa1670d554a9d851d57c4,
it's a good idea to have some tests for this ;)
Diffstat (limited to 'tests/test_climat2.py')
| -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'], |
