aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cli_test.py
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-07-03 23:04:40 +0800
committerzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-07-05 20:05:26 +0800
commit4c7387f811c01bd74b5ae6e0d0cca4bc98d298e8 (patch)
tree3ca8f61a152b196ca65ef526ae9659c0bddbb411 /tests/cli_test.py
parent1560721b960531785a29d70a572f0ee791234fb0 (diff)
Add some UT test cases and fix pep8 errors for cli and env_setup.
JIRA:QTIP-89 Change-Id: I4a46898071001f679f1a032a560d605dffc8eb9f Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'tests/cli_test.py')
-rw-r--r--tests/cli_test.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/cli_test.py b/tests/cli_test.py
new file mode 100644
index 00000000..f12e8fed
--- /dev/null
+++ b/tests/cli_test.py
@@ -0,0 +1,20 @@
+import pytest
+from func.cli import cli
+
+
+class TestClass:
+ @pytest.mark.parametrize("test_input, expected", [
+ (['-l',
+ 'zte',
+ '-f',
+ 'compute'], "You have specified a lab that is not present in test_cases"),
+ (['-l',
+ 'zte-pod1',
+ '-f',
+ 'test'], "Test File Does not exist in test_list")
+ ])
+ def test_cli_error(self, capfd, test_input, expected):
+ with pytest.raises(SystemExit):
+ cli(test_input)
+ resout, reserr = capfd.readouterr()
+ assert expected in resout