Skip to content
Snippets Groups Projects
Commit ecb199b4 authored by Julien (jvoisin) Voisin's avatar Julien (jvoisin) Voisin
Browse files

Add a cli-related test

Since I didn't notice that it was broken
until c5f51345,
it's a good idea to have some tests for this ;)
parent e34bc19f
No related branches found
No related tags found
No related merge requests found
import unittest
import os
import shutil
import subprocess
import unittest
class TestHelp(unittest.TestCase):
......@@ -14,6 +16,27 @@ class TestHelp(unittest.TestCase):
self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]', stdout)
class TestCleanMeta(unittest.TestCase):
def test_jpg(self):
shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg')
proc = subprocess.Popen(['./main.py', '--show', './tests/data/clean.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Comment: Created with GIMP', stdout)
proc = subprocess.Popen(['./main.py', './tests/data/clean.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
proc = subprocess.Popen(['./main.py', '--show', './tests/data/clean.jpg.cleaned'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertNotIn(b'Comment: Created with GIMP', stdout)
os.remove('./tests/data/clean.jpg')
class TestGetMeta(unittest.TestCase):
def test_pdf(self):
proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.pdf'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment