[Pkg-privacy-commits] [mat] 43/68: Add tests for the help command

Sascha Steinbiss sascha at steinbiss.name
Sun Jan 3 12:32:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

sascha-guest pushed a commit to branch master
in repository mat.

commit a13203d62c17bd25de0942d131ff7257d0188f1d
Author: jvoisin <julien.voisin at dustri.org>
Date:   Tue Dec 8 15:21:10 2015 +0100

    Add tests for the help command
---
 test/clitest.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/clitest.py b/test/clitest.py
index 3b09c62..ccac675 100644
--- a/test/clitest.py
+++ b/test/clitest.py
@@ -139,6 +139,29 @@ class TestUnsupported(test.MATTest):
                         '\n- libtest.py\n- test.py\n- clitest.py\n'
                         in str(stdout))
 
+class TestHelp(test.MATTest):
+    """ Test the different ways to trigger help """
+    def test_dash_h(self):
+        """ test help invocation with `-h` and `--help` """
+        proc = subprocess.Popen([MAT_PATH, '-h'], stdout=subprocess.PIPE)
+        stdout, _ = proc.communicate()
+        self.assertTrue('show this help message and exit' in stdout)
+
+        proc = subprocess.Popen([MAT_PATH, '--help'], stdout=subprocess.PIPE)
+        stdout, _ = proc.communicate()
+        self.assertTrue('show this help message and exit' in stdout)
+
+    def test_no_argument(self):
+        """ test help invocation when no argument is provided """
+        proc = subprocess.Popen([MAT_PATH], stdout=subprocess.PIPE)
+        stdout, _ = proc.communicate()
+        self.assertTrue('show this help message and exit' in stdout)
+
+    def test_wrong_argument(self):
+        """ Test MAT's behaviour on wrong argument """
+        proc = subprocess.Popen([MAT_PATH, '--obviously-wrong-argument'], stderr=subprocess.PIPE)
+        _, stderr = proc.communicate()
+        self.assertTrue(('usage: mat [-h]' and ' error: unrecognized arguments:') in stderr)
 
 def get_tests():
     """ Return every clitests"""
@@ -148,4 +171,5 @@ def get_tests():
     suite.addTest(unittest.makeSuite(TestisCleancli))
     suite.addTest(unittest.makeSuite(TestUnsupported))
     suite.addTest(unittest.makeSuite(TestFileAttributes))
+    suite.addTest(unittest.makeSuite(TestHelp))
     return suite

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/mat.git



More information about the Pkg-privacy-commits mailing list