summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/cli/test_metric.py9
-rw-r--r--tests/unit/cli/test_options.py2
-rw-r--r--tests/unit/cli/test_plan.py31
-rw-r--r--tests/unit/cli/test_qpi.py31
4 files changed, 69 insertions, 4 deletions
diff --git a/tests/unit/cli/test_metric.py b/tests/unit/cli/test_metric.py
index ed10689c..239da96e 100644
--- a/tests/unit/cli/test_metric.py
+++ b/tests/unit/cli/test_metric.py
@@ -10,7 +10,7 @@
import pytest
from click.testing import CliRunner
-from qtip.cli.commands.cmd_metric import cli
+from qtip.cli.entry import cli
@pytest.fixture()
@@ -19,10 +19,13 @@ def runner():
def test_list(runner):
- result = runner.invoke(cli, ['list'])
+ result = runner.invoke(cli, ['metric', 'list'])
assert result.output == ''
def test_run(runner):
- result = runner.invoke(cli, ['run'])
+ result = runner.invoke(cli, ['metric', 'run', 'fake-metric'])
assert result.output == ''
+
+ result = runner.invoke(cli, ['metric', 'run'])
+ assert 'Missing argument "name".' in result.output
diff --git a/tests/unit/cli/test_options.py b/tests/unit/cli/test_options.py
index 5129b5cc..f9472814 100644
--- a/tests/unit/cli/test_options.py
+++ b/tests/unit/cli/test_options.py
@@ -25,7 +25,7 @@ class TestClass(object):
def test_version(self, runner):
result = runner.invoke(cli, ['--version'])
- assert '' in result.output
+ assert 'dev' in result.output
def test_debug(self, runner):
result = runner.invoke(cli, ['-d'])
diff --git a/tests/unit/cli/test_plan.py b/tests/unit/cli/test_plan.py
new file mode 100644
index 00000000..3ce3766e
--- /dev/null
+++ b/tests/unit/cli/test_plan.py
@@ -0,0 +1,31 @@
+###############################################################
+# Copyright (c) 2016 ZTE Corp and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import pytest
+from click.testing import CliRunner
+
+from qtip.cli.entry import cli
+
+
+@pytest.fixture()
+def runner():
+ return CliRunner()
+
+
+def test_list(runner):
+ result = runner.invoke(cli, ['plan', 'list'])
+ assert result.output == ''
+
+
+def test_run(runner):
+ result = runner.invoke(cli, ['plan', 'run', 'fake-plan'])
+ assert result.output == ''
+
+ result = runner.invoke(cli, ['plan', 'run'])
+ assert 'Missing argument "name".' in result.output
diff --git a/tests/unit/cli/test_qpi.py b/tests/unit/cli/test_qpi.py
new file mode 100644
index 00000000..992c85d7
--- /dev/null
+++ b/tests/unit/cli/test_qpi.py
@@ -0,0 +1,31 @@
+###############################################################
+# Copyright (c) 2016 ZTE Corp and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import pytest
+from click.testing import CliRunner
+
+from qtip.cli.entry import cli
+
+
+@pytest.fixture()
+def runner():
+ return CliRunner()
+
+
+def test_list(runner):
+ result = runner.invoke(cli, ['qpi', 'list'])
+ assert result.output == ''
+
+
+def test_run(runner):
+ result = runner.invoke(cli, ['qpi', 'run', 'fake-qpi'])
+ assert result.output == ''
+
+ result = runner.invoke(cli, ['qpi', 'run'])
+ assert 'Missing argument "name".' in result.output