diff options
| -rwxr-xr-x | main.py | 2 | ||||
| -rw-r--r-- | tests/test_climat2.py | 10 |
2 files changed, 9 insertions, 3 deletions
| @@ -30,7 +30,7 @@ def create_arg_parser(): | |||
| 30 | parser.add_argument('-l', '--list', action='store_true', | 30 | parser.add_argument('-l', '--list', action='store_true', |
| 31 | help='list all supported fileformats') | 31 | help='list all supported fileformats') |
| 32 | 32 | ||
| 33 | info = parser.add_argument_group('Information') | 33 | info = parser.add_mutually_exclusive_group() |
| 34 | info.add_argument('-c', '--check', action='store_true', | 34 | info.add_argument('-c', '--check', action='store_true', |
| 35 | help='check if a file is free of harmful metadatas') | 35 | help='check if a file is free of harmful metadatas') |
| 36 | info.add_argument('-s', '--show', action='store_true', | 36 | info.add_argument('-s', '--show', action='store_true', |
diff --git a/tests/test_climat2.py b/tests/test_climat2.py index 67b56eb..864ee0d 100644 --- a/tests/test_climat2.py +++ b/tests/test_climat2.py | |||
| @@ -8,12 +8,12 @@ class TestHelp(unittest.TestCase): | |||
| 8 | def test_help(self): | 8 | def test_help(self): |
| 9 | proc = subprocess.Popen(['./main.py', '--help'], stdout=subprocess.PIPE) | 9 | proc = subprocess.Popen(['./main.py', '--help'], stdout=subprocess.PIPE) |
| 10 | stdout, _ = proc.communicate() | 10 | stdout, _ = proc.communicate() |
| 11 | self.assertIn(b'usage: main.py [-h] [-v] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) | 11 | self.assertIn(b'usage: main.py [-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(['./main.py'], stdout=subprocess.PIPE) | 14 | proc = subprocess.Popen(['./main.py'], stdout=subprocess.PIPE) |
| 15 | stdout, _ = proc.communicate() | 15 | stdout, _ = proc.communicate() |
| 16 | self.assertIn(b'usage: main.py [-h] [-v] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) | 16 | self.assertIn(b'usage: main.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout) |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | class TestVersion(unittest.TestCase): | 19 | class TestVersion(unittest.TestCase): |
| @@ -23,6 +23,12 @@ class TestVersion(unittest.TestCase): | |||
| 23 | self.assertTrue(stdout.startswith(b'MAT2 ')) | 23 | self.assertTrue(stdout.startswith(b'MAT2 ')) |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | class TestExclusiveArgs(unittest.TestCase): | ||
| 27 | def test_version(self): | ||
| 28 | proc = subprocess.Popen(['./main.py', '-s', '-c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
| 29 | stdout, stderr = proc.communicate() | ||
| 30 | self.assertIn(b'main.py: error: argument -c/--check: not allowed with argument -s/--show', stderr) | ||
| 31 | |||
| 26 | 32 | ||
| 27 | class TestReturnValue(unittest.TestCase): | 33 | class TestReturnValue(unittest.TestCase): |
| 28 | def test_nonzero(self): | 34 | def test_nonzero(self): |
