summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2018-04-04 00:37:55 +0200
committerjvoisin2018-04-04 00:37:55 +0200
commit6c19e43e5dea72a0b15d4b1291544b1d626149d7 (patch)
tree352048ea6a3b7a54a36a38e1d9a685653fbf6812
parent6398befe1417be97b4b53ea5b53134f3ed09faeb (diff)
Add even more tests for the cli
-rw-r--r--tests/test_climat2.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
index a0bcafc..16f97a2 100644
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -8,3 +8,38 @@ class TestHelp(unittest.TestCase):
8 proc = subprocess.Popen(['./main.py', '--help'], stdout=subprocess.PIPE) 8 proc = subprocess.Popen(['./main.py', '--help'], stdout=subprocess.PIPE)
9 stdout, _ = proc.communicate() 9 stdout, _ = proc.communicate()
10 self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [files [files ...]]', stdout) 10 self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [files [files ...]]', stdout)
11
12class TestGetMeta(unittest.TestCase):
13 def test_pdf(self):
14 proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.pdf'],
15 stdout=subprocess.PIPE)
16 stdout, _ = proc.communicate()
17 self.assertIn(b'producer: pdfTeX-1.40.14', stdout)
18
19 def test_png(self):
20 proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.png'],
21 stdout=subprocess.PIPE)
22 stdout, _ = proc.communicate()
23 self.assertIn(b'Comment: This is a comment, be careful!', stdout)
24
25 def test_jpg(self):
26 proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.jpg'],
27 stdout=subprocess.PIPE)
28 stdout, _ = proc.communicate()
29 self.assertIn(b'Comment: Created with GIMP', stdout)
30
31 def test_docx(self):
32 proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.docx'],
33 stdout=subprocess.PIPE)
34 stdout, _ = proc.communicate()
35 self.assertIn(b'Application: LibreOffice/5.4.5.1$Linux_X86_64', stdout)
36 self.assertIn(b'creator: julien voisin', stdout)
37 self.assertIn(b'revision: 1', stdout)
38
39 def test_odt(self):
40 proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.odt'],
41 stdout=subprocess.PIPE)
42 stdout, _ = proc.communicate()
43 self.assertIn(b'generator: LibreOffice/3.3$Unix', stdout)
44 self.assertIn(b'creator: jvoisin', stdout)
45 self.assertIn(b'date_time: 2011-07-26 02:40:16', stdout)