summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Dachary <loic@dachary.org>2013-09-15 17:39:22 +0200
committerLoic Dachary <loic@dachary.org>2013-09-23 23:46:44 +0200
commitc09d01c21084085b3ebe478c54b1d92e469aaa69 (patch)
tree6925dbc67e9a25312c95ba73f587300c8ed91109
parent0ff003065cf336850becf8aa433cc5c30365d6c3 (diff)
downloadceph-c09d01c21084085b3ebe478c54b1d92e469aaa69.tar.gz
ceph_argparse: unit tests for validate_command mon
http://tracker.ceph.com/issues/6274 refs #6274 Reviewed-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com> Signed-off-by: Loic Dachary <loic@dachary.org>
-rwxr-xr-xsrc/test/pybind/test_ceph_argparse.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/pybind/test_ceph_argparse.py b/src/test/pybind/test_ceph_argparse.py
index 63d5d8b8af0..09cc9d8919d 100755
--- a/src/test/pybind/test_ceph_argparse.py
+++ b/src/test/pybind/test_ceph_argparse.py
@@ -465,6 +465,35 @@ class TestMDS(TestArgparse):
'1',
'-1',
'--yes-i-really-mean-it']))
+
+
+class TestMon(TestArgparse):
+
+ def test_dump(self):
+ self.check_0_or_1_natural_arg('mon', 'dump')
+
+ def test_stat(self):
+ self.check_no_arg('mon', 'stat')
+
+ def test_getmap(self):
+ self.check_0_or_1_natural_arg('mon', 'getmap')
+
+ def test_add(self):
+ self.assert_valid_command(['mon', 'add', 'name', '1.2.3.4:1234'])
+ assert_equal({}, validate_command(sigdict, ['mon', 'add']))
+ assert_equal({}, validate_command(sigdict, ['mon', 'add', 'name']))
+ assert_equal({}, validate_command(sigdict, ['mon', 'add',
+ 'name',
+ '400.500.600.700']))
+ assert_equal({}, validate_command(sigdict, ['mon', 'add', 'name',
+ '1.2.3.4:1234',
+ 'toomany']))
+
+ def test_remove(self):
+ self.assert_valid_command(['mon', 'remove', 'name'])
+ assert_equal({}, validate_command(sigdict, ['mon', 'remove']))
+ assert_equal({}, validate_command(sigdict, ['mon', 'remove',
+ 'name', 'toomany']))
# Local Variables:
# compile-command: "cd ../.. ; make -j4 &&
# PYTHONPATH=pybind nosetests --stop \