summaryrefslogtreecommitdiff
path: root/tests/test_climat2.py
diff options
context:
space:
mode:
authorjvoisin2018-04-16 23:20:21 +0200
committerjvoisin2018-04-16 23:20:21 +0200
commitecb199b4a6a2f54b84237d4f74c145a051c4c08b (patch)
tree1692db908b0958a2bfbe2203535beeda7ba364f9 /tests/test_climat2.py
parente34bc19f7126b80764a4c8747a7a2a1636289396 (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.py25
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 @@
1import unittest 1import os
2import shutil
2import subprocess 3import subprocess
4import unittest
3 5
4 6
5class TestHelp(unittest.TestCase): 7class 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
19class 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
17class TestGetMeta(unittest.TestCase): 40class 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'],