Add basic Keystone CLI tests
New cli.output_parser helpers for parsing 'ascii-tables'
often used in CLIs output.
New basic tests for keystone cli, verifies only read-only
actions (return codes and basic structure of output).
Change-Id: I4fea08b14e32c62c47e347b401e3f5703836c184
diff --git a/cli/__init__.py b/cli/__init__.py
index 37aec93..6ffe229 100644
--- a/cli/__init__.py
+++ b/cli/__init__.py
@@ -21,6 +21,7 @@
from oslo.config import cfg
+import cli.output_parser
import tempest.test
@@ -51,6 +52,7 @@
super(ClientTestBase, cls).setUpClass()
def __init__(self, *args, **kwargs):
+ self.parser = cli.output_parser
super(ClientTestBase, self).__init__(*args, **kwargs)
def nova(self, action, flags='', params='', admin=True, fail_ok=False):
@@ -63,6 +65,11 @@
return self.cmd(
'nova-manage', action, flags, params, fail_ok)
+ def keystone(self, action, flags='', params='', admin=True, fail_ok=False):
+ """Executes keystone command for the given action."""
+ return self.cmd_with_auth(
+ 'keystone', action, flags, params, admin, fail_ok)
+
def cmd_with_auth(self, cmd, action, flags='', params='',
admin=True, fail_ok=False):
"""Executes given command with auth attributes appended."""
@@ -86,3 +93,9 @@
LOG.error("command output:\n%s" % e.output)
raise
return result
+
+ def assertTableStruct(self, items, field_names):
+ """Verify that all items has keys listed in field_names."""
+ for item in items:
+ for field in field_names:
+ self.assertIn(field, item)