summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Dachary <loic@dachary.org>2013-09-15 17:34:57 +0200
committerLoic Dachary <loic@dachary.org>2013-09-23 23:46:44 +0200
commit253e53f41aaa2782aeca6f64a2e6b4bd88063fdc (patch)
tree1a98a1f402ee3e58c4df18ce946790f95ba1e09f
parentd3bf39e7618b91a17db52740770385411aafa68c (diff)
downloadceph-253e53f41aaa2782aeca6f64a2e6b4bd88063fdc.tar.gz
ceph_argparse: unit tests for validate_command auth
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.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/test/pybind/test_ceph_argparse.py b/src/test/pybind/test_ceph_argparse.py
index 43724b09a8e..3fc8d21de34 100755
--- a/src/test/pybind/test_ceph_argparse.py
+++ b/src/test/pybind/test_ceph_argparse.py
@@ -182,6 +182,58 @@ class TestPG(TestArgparse):
def test_set_nearfull_ratio(self):
self.set_ratio('set_nearfull_ratio')
+
+
+class TestAuth(TestArgparse):
+
+ def test_export(self):
+ self.assert_valid_command(['auth', 'export'])
+ self.assert_valid_command(['auth',
+ 'export',
+ 'string'])
+ assert_equal({}, validate_command(sigdict, ['auth',
+ 'export',
+ 'string',
+ 'toomany']))
+
+ def test_get(self):
+ self.check_1_string_arg('auth', 'get')
+
+ def test_get_key(self):
+ self.check_1_string_arg('auth', 'get-key')
+
+ def test_print_key(self):
+ self.check_1_string_arg('auth', 'print-key')
+ self.check_1_string_arg('auth', 'print_key')
+
+ def test_list(self):
+ self.check_no_arg('auth', 'list')
+
+ def test_import(self):
+ self.check_no_arg('auth', 'import')
+
+ def test_add(self):
+ self.check_1_or_more_string_args('auth', 'add')
+
+ def test_get_or_create_key(self):
+ self.check_1_or_more_string_args('auth', 'get-or-create-key')
+
+ def test_get_or_create(self):
+ self.check_1_or_more_string_args('auth', 'get-or-create')
+
+ def test_caps(self):
+ assert_equal({}, validate_command(sigdict, ['auth',
+ 'caps']))
+ assert_equal({}, validate_command(sigdict, ['auth',
+ 'caps',
+ 'string']))
+ self.assert_valid_command(['auth',
+ 'caps',
+ 'string',
+ 'more string'])
+
+ def test_del(self):
+ self.check_1_string_arg('auth', 'del')
# Local Variables:
# compile-command: "cd ../.. ; make -j4 &&
# PYTHONPATH=pybind nosetests --stop \