diff options
Diffstat (limited to 'tests/unit/cli')
-rw-r--r-- | tests/unit/cli/cmd_metric_test.py | 14 | ||||
-rw-r--r-- | tests/unit/cli/cmd_plan_test.py | 9 | ||||
-rw-r--r-- | tests/unit/cli/cmd_qpi_test.py | 11 |
3 files changed, 20 insertions, 14 deletions
diff --git a/tests/unit/cli/cmd_metric_test.py b/tests/unit/cli/cmd_metric_test.py index 30f3448a..cd496ad9 100644 --- a/tests/unit/cli/cmd_metric_test.py +++ b/tests/unit/cli/cmd_metric_test.py @@ -1,5 +1,5 @@ ############################################################### -# Copyright (c) 2016 ZTE Corp and others. +# Copyright (c) 2017 taseer94@gmail.com and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -8,8 +8,8 @@ ############################################################################## import pytest -from click.testing import CliRunner +from click.testing import CliRunner from qtip.cli.entry import cli @@ -20,7 +20,9 @@ def runner(): def test_list(runner): result = runner.invoke(cli, ['metric', 'list']) - assert result.output == '' + assert 'dhrystone' and 'whetstone' and 'dpi' and \ + 'ramspeed' and 'fake-metric' and 'ssl' \ + in result.output def test_run(runner): @@ -32,8 +34,10 @@ def test_run(runner): def test_show(runner): - result = runner.invoke(cli, ['metric', 'show', 'fake-metric']) - assert result.output == '' + result = runner.invoke(cli, ['metric', 'show', 'dhrystone']) + assert 'Name: dhrystone' in result.output + assert 'Description: A synthetic computing benchmark program intended to be representative of' \ + 'system (integer) programming.' result = runner.invoke(cli, ['metric', 'show']) assert 'Missing argument "name".' in result.output diff --git a/tests/unit/cli/cmd_plan_test.py b/tests/unit/cli/cmd_plan_test.py index 1708c340..30025ae0 100644 --- a/tests/unit/cli/cmd_plan_test.py +++ b/tests/unit/cli/cmd_plan_test.py @@ -1,5 +1,5 @@ ############################################################### -# Copyright (c) 2016 ZTE Corp and others. +# Copyright (c) 2017 taseer94@gmail.com and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -20,7 +20,7 @@ def runner(): def test_list(runner): result = runner.invoke(cli, ['plan', 'list']) - assert result.output == '' + assert 'Plan' and 'compute' and 'sample' in result.output def test_run(runner): @@ -32,8 +32,9 @@ def test_run(runner): def test_show(runner): - result = runner.invoke(cli, ['plan', 'show', 'fake-plan']) - assert result.output == '' + result = runner.invoke(cli, ['plan', 'show', 'compute']) + assert 'Name: compute QPI' in result.output + assert 'Description: compute QPI profile' result = runner.invoke(cli, ['plan', 'show']) assert 'Missing argument "name".' in result.output diff --git a/tests/unit/cli/cmd_qpi_test.py b/tests/unit/cli/cmd_qpi_test.py index 485d5462..3d2c2613 100644 --- a/tests/unit/cli/cmd_qpi_test.py +++ b/tests/unit/cli/cmd_qpi_test.py @@ -1,5 +1,5 @@ ############################################################### -# Copyright (c) 2016 ZTE Corp and others. +# Copyright (c) 2017 taseer94@gmail.com and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -8,9 +8,9 @@ ############################################################################## import pytest -from click.testing import CliRunner from qtip.cli.entry import cli +from click.testing import CliRunner @pytest.fixture(scope="module") @@ -20,7 +20,7 @@ def runner(): def test_list(runner): result = runner.invoke(cli, ['qpi', 'list']) - assert result.output == '' + assert 'QPIs' and 'compute' in result.output def test_run(runner): @@ -32,8 +32,9 @@ def test_run(runner): def test_show(runner): - result = runner.invoke(cli, ['qpi', 'show', 'fake-qpi']) - assert result.output == '' + result = runner.invoke(cli, ['qpi', 'show', 'compute']) + assert 'Name: compute' in result.output + assert 'Description: sample performance index of computing' in result.output result = runner.invoke(cli, ['qpi', 'show']) assert 'Missing argument "name".' in result.output |