summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjvoisin2018-05-21 22:49:40 +0200
committerjvoisin2018-05-21 22:49:40 +0200
commit8cf9aeeb67b9de77434acf9dbd8cc4b3792f8741 (patch)
tree63616ecf1de61db7f02c1e1f3331d5817228e95b /tests
parent38fae60b8beaf9c7b37c65325d2d285e62b6cb85 (diff)
Rename mat2.py to mat2
Diffstat (limited to 'tests')
-rw-r--r--tests/test_climat2.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
index 36973bf..fd72278 100644
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -6,43 +6,43 @@ import unittest
6 6
7class TestHelp(unittest.TestCase): 7class TestHelp(unittest.TestCase):
8 def test_help(self): 8 def test_help(self):
9 proc = subprocess.Popen(['./mat2.py', '--help'], stdout=subprocess.PIPE) 9 proc = subprocess.Popen(['./mat2', '--help'], stdout=subprocess.PIPE)
10 stdout, _ = proc.communicate() 10 stdout, _ = proc.communicate()
11 self.assertIn(b'usage: mat2.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout) 11 self.assertIn(b'usage: mat2 [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout)
12 12
13 def test_no_arg(self): 13 def test_no_arg(self):
14 proc = subprocess.Popen(['./mat2.py'], stdout=subprocess.PIPE) 14 proc = subprocess.Popen(['./mat2'], stdout=subprocess.PIPE)
15 stdout, _ = proc.communicate() 15 stdout, _ = proc.communicate()
16 self.assertIn(b'usage: mat2.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout) 16 self.assertIn(b'usage: mat2 [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout)
17 17
18 18
19class TestVersion(unittest.TestCase): 19class TestVersion(unittest.TestCase):
20 def test_version(self): 20 def test_version(self):
21 proc = subprocess.Popen(['./mat2.py', '--version'], stdout=subprocess.PIPE) 21 proc = subprocess.Popen(['./mat2', '--version'], stdout=subprocess.PIPE)
22 stdout, _ = proc.communicate() 22 stdout, _ = proc.communicate()
23 self.assertTrue(stdout.startswith(b'MAT2 ')) 23 self.assertTrue(stdout.startswith(b'MAT2 '))
24 24
25 25
26class TestExclusiveArgs(unittest.TestCase): 26class TestExclusiveArgs(unittest.TestCase):
27 def test_version(self): 27 def test_version(self):
28 proc = subprocess.Popen(['./mat2.py', '-s', '-c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 28 proc = subprocess.Popen(['./mat2', '-s', '-c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
29 stdout, stderr = proc.communicate() 29 stdout, stderr = proc.communicate()
30 self.assertIn(b'mat2.py: error: argument -c/--check: not allowed with argument -s/--show', stderr) 30 self.assertIn(b'mat2: error: argument -c/--check: not allowed with argument -s/--show', stderr)
31 31
32 32
33class TestReturnValue(unittest.TestCase): 33class TestReturnValue(unittest.TestCase):
34 def test_nonzero(self): 34 def test_nonzero(self):
35 ret = subprocess.call(['./mat2.py', './mat2.py'], stdout=subprocess.DEVNULL) 35 ret = subprocess.call(['./mat2', './mat2'], stdout=subprocess.DEVNULL)
36 self.assertEqual(255, ret) 36 self.assertEqual(255, ret)
37 37
38 ret = subprocess.call(['./mat2.py', '--whololo'], stderr=subprocess.DEVNULL) 38 ret = subprocess.call(['./mat2', '--whololo'], stderr=subprocess.DEVNULL)
39 self.assertEqual(2, ret) 39 self.assertEqual(2, ret)
40 40
41 def test_zero(self): 41 def test_zero(self):
42 ret = subprocess.call(['./mat2.py'], stdout=subprocess.DEVNULL) 42 ret = subprocess.call(['./mat2'], stdout=subprocess.DEVNULL)
43 self.assertEqual(0, ret) 43 self.assertEqual(0, ret)
44 44
45 ret = subprocess.call(['./mat2.py', '--show', './mat2.py'], stdout=subprocess.DEVNULL) 45 ret = subprocess.call(['./mat2', '--show', './mat2'], stdout=subprocess.DEVNULL)
46 self.assertEqual(0, ret) 46 self.assertEqual(0, ret)
47 47
48 48
@@ -50,16 +50,16 @@ class TestCleanMeta(unittest.TestCase):
50 def test_jpg(self): 50 def test_jpg(self):
51 shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg') 51 shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg')
52 52
53 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/clean.jpg'], 53 proc = subprocess.Popen(['./mat2', '--show', './tests/data/clean.jpg'],
54 stdout=subprocess.PIPE) 54 stdout=subprocess.PIPE)
55 stdout, _ = proc.communicate() 55 stdout, _ = proc.communicate()
56 self.assertIn(b'Comment: Created with GIMP', stdout) 56 self.assertIn(b'Comment: Created with GIMP', stdout)
57 57
58 proc = subprocess.Popen(['./mat2.py', './tests/data/clean.jpg'], 58 proc = subprocess.Popen(['./mat2', './tests/data/clean.jpg'],
59 stdout=subprocess.PIPE) 59 stdout=subprocess.PIPE)
60 stdout, _ = proc.communicate() 60 stdout, _ = proc.communicate()
61 61
62 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/clean.cleaned.jpg'], 62 proc = subprocess.Popen(['./mat2', '--show', './tests/data/clean.cleaned.jpg'],
63 stdout=subprocess.PIPE) 63 stdout=subprocess.PIPE)
64 stdout, _ = proc.communicate() 64 stdout, _ = proc.communicate()
65 self.assertNotIn(b'Comment: Created with GIMP', stdout) 65 self.assertNotIn(b'Comment: Created with GIMP', stdout)
@@ -69,25 +69,25 @@ class TestCleanMeta(unittest.TestCase):
69 69
70class TestGetMeta(unittest.TestCase): 70class TestGetMeta(unittest.TestCase):
71 def test_pdf(self): 71 def test_pdf(self):
72 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.pdf'], 72 proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.pdf'],
73 stdout=subprocess.PIPE) 73 stdout=subprocess.PIPE)
74 stdout, _ = proc.communicate() 74 stdout, _ = proc.communicate()
75 self.assertIn(b'producer: pdfTeX-1.40.14', stdout) 75 self.assertIn(b'producer: pdfTeX-1.40.14', stdout)
76 76
77 def test_png(self): 77 def test_png(self):
78 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.png'], 78 proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.png'],
79 stdout=subprocess.PIPE) 79 stdout=subprocess.PIPE)
80 stdout, _ = proc.communicate() 80 stdout, _ = proc.communicate()
81 self.assertIn(b'Comment: This is a comment, be careful!', stdout) 81 self.assertIn(b'Comment: This is a comment, be careful!', stdout)
82 82
83 def test_jpg(self): 83 def test_jpg(self):
84 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.jpg'], 84 proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.jpg'],
85 stdout=subprocess.PIPE) 85 stdout=subprocess.PIPE)
86 stdout, _ = proc.communicate() 86 stdout, _ = proc.communicate()
87 self.assertIn(b'Comment: Created with GIMP', stdout) 87 self.assertIn(b'Comment: Created with GIMP', stdout)
88 88
89 def test_docx(self): 89 def test_docx(self):
90 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.docx'], 90 proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.docx'],
91 stdout=subprocess.PIPE) 91 stdout=subprocess.PIPE)
92 stdout, _ = proc.communicate() 92 stdout, _ = proc.communicate()
93 self.assertIn(b'Application: LibreOffice/5.4.5.1$Linux_X86_64', stdout) 93 self.assertIn(b'Application: LibreOffice/5.4.5.1$Linux_X86_64', stdout)
@@ -95,7 +95,7 @@ class TestGetMeta(unittest.TestCase):
95 self.assertIn(b'revision: 1', stdout) 95 self.assertIn(b'revision: 1', stdout)
96 96
97 def test_odt(self): 97 def test_odt(self):
98 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.odt'], 98 proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.odt'],
99 stdout=subprocess.PIPE) 99 stdout=subprocess.PIPE)
100 stdout, _ = proc.communicate() 100 stdout, _ = proc.communicate()
101 self.assertIn(b'generator: LibreOffice/3.3$Unix', stdout) 101 self.assertIn(b'generator: LibreOffice/3.3$Unix', stdout)
@@ -103,14 +103,14 @@ class TestGetMeta(unittest.TestCase):
103 self.assertIn(b'date_time: 2011-07-26 02:40:16', stdout) 103 self.assertIn(b'date_time: 2011-07-26 02:40:16', stdout)
104 104
105 def test_mp3(self): 105 def test_mp3(self):
106 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.mp3'], 106 proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.mp3'],
107 stdout=subprocess.PIPE) 107 stdout=subprocess.PIPE)
108 stdout, _ = proc.communicate() 108 stdout, _ = proc.communicate()
109 self.assertIn(b'TALB: harmfull', stdout) 109 self.assertIn(b'TALB: harmfull', stdout)
110 self.assertIn(b'COMM::: Thank you for using MAT !', stdout) 110 self.assertIn(b'COMM::: Thank you for using MAT !', stdout)
111 111
112 def test_flac(self): 112 def test_flac(self):
113 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.flac'], 113 proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.flac'],
114 stdout=subprocess.PIPE) 114 stdout=subprocess.PIPE)
115 stdout, _ = proc.communicate() 115 stdout, _ = proc.communicate()
116 self.assertIn(b'comments: Thank you for using MAT !', stdout) 116 self.assertIn(b'comments: Thank you for using MAT !', stdout)
@@ -118,7 +118,7 @@ class TestGetMeta(unittest.TestCase):
118 self.assertIn(b'title: I am so', stdout) 118 self.assertIn(b'title: I am so', stdout)
119 119
120 def test_ogg(self): 120 def test_ogg(self):
121 proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.ogg'], 121 proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.ogg'],
122 stdout=subprocess.PIPE) 122 stdout=subprocess.PIPE)
123 stdout, _ = proc.communicate() 123 stdout, _ = proc.communicate()
124 self.assertIn(b'comments: Thank you for using MAT !', stdout) 124 self.assertIn(b'comments: Thank you for using MAT !', stdout)