X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Ftests%2Ftest_terminal.py;fp=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Ftests%2Ftest_terminal.py;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=9435dbb263ac9660b1e66ae6561ea19f4302cfbd;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/ceph-volume/ceph_volume/tests/test_terminal.py b/src/ceph/src/ceph-volume/ceph_volume/tests/test_terminal.py deleted file mode 100644 index 9435dbb..0000000 --- a/src/ceph/src/ceph-volume/ceph_volume/tests/test_terminal.py +++ /dev/null @@ -1,68 +0,0 @@ -import pytest -from ceph_volume import terminal - - -class SubCommand(object): - - help = "this is the subcommand help" - - def __init__(self, argv): - self.argv = argv - - def main(self): - pass - - -class BadSubCommand(object): - - def __init__(self, argv): - self.argv = argv - - def main(self): - raise SystemExit(100) - - -class TestSubhelp(object): - - def test_no_sub_command_help(self): - assert terminal.subhelp({}) == '' - - def test_single_level_help(self): - result = terminal.subhelp({'sub': SubCommand}) - - assert 'this is the subcommand help' in result - - def test_has_title_header(self): - result = terminal.subhelp({'sub': SubCommand}) - assert 'Available subcommands:' in result - - def test_command_with_no_help(self): - class SubCommandNoHelp(object): - pass - result = terminal.subhelp({'sub': SubCommandNoHelp}) - assert result == '' - - -class TestDispatch(object): - - def test_no_subcommand_found(self): - result = terminal.dispatch({'sub': SubCommand}, argv=[]) - assert result is None - - def test_no_main_found(self): - class NoMain(object): - - def __init__(self, argv): - pass - result = terminal.dispatch({'sub': NoMain}, argv=['sub']) - assert result is None - - def test_subcommand_found_and_dispatched(self): - with pytest.raises(SystemExit) as error: - terminal.dispatch({'sub': SubCommand}, argv=['sub']) - assert str(error.value) == '0' - - def test_subcommand_found_and_dispatched_with_errors(self): - with pytest.raises(SystemExit) as error: - terminal.dispatch({'sub': BadSubCommand}, argv=['sub']) - assert str(error.value) == '100'