From 5f6ddf2a0f6b1e334b6bed5df2c7ebac8111d829 Mon Sep 17 00:00:00 2001 From: Travis Rhoden Date: Wed, 24 Jun 2015 15:33:19 -0700 Subject: [PATCH] [RM-11742] Add argparse tests for mon destroy Signed-off-by: Travis Rhoden --- ceph_deploy/tests/parser/test_mon.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ceph_deploy/tests/parser/test_mon.py b/ceph_deploy/tests/parser/test_mon.py index 8dbd0f7..9a115f8 100644 --- a/ceph_deploy/tests/parser/test_mon.py +++ b/ceph_deploy/tests/parser/test_mon.py @@ -110,3 +110,24 @@ class TestParserMON(object): def test_mon_add_multi_host_raises_err(self): with pytest.raises(SystemExit): self.parser.parse_args('mon add test1 test2'.split()) + + @pytest.mark.skipif(reason="http://tracker.ceph.com/issues/12151") + def test_mon_destroy_help(self, capsys): + with pytest.raises(SystemExit): + self.parser.parse_args('mon destroy --help'.split()) + out, err = capsys.readouterr() + assert 'usage: ceph-deploy mon destroy' in out + + @pytest.mark.skipif(reason="http://tracker.ceph.com/issues/12151") + def test_mon_destroy_no_host_raises_err(self): + with pytest.raises(SystemExit): + self.parser.parse_args('mon destroy'.split()) + + def test_mon_destroy_one_host_okay(self): + args = self.parser.parse_args('mon destroy test1'.split()) + assert args.mon == ["test1"] + + def test_mon_destroy_multi_host(self): + hosts = ['host1', 'host2', 'host3'] + args = self.parser.parse_args('mon destroy'.split() + hosts) + assert args.mon == hosts -- 2.47.3