Merge "Expand CLI test"
diff --git a/cli/__init__.py b/cli/__init__.py
index 2548f24..37aec93 100644
--- a/cli/__init__.py
+++ b/cli/__init__.py
@@ -58,6 +58,11 @@
return self.cmd_with_auth(
'nova', action, flags, params, admin, fail_ok)
+ def nova_manage(self, action, flags='', params='', fail_ok=False):
+ """Executes nova-manage command for the given action."""
+ return self.cmd(
+ 'nova-manage', action, flags, params, fail_ok)
+
def cmd_with_auth(self, cmd, action, flags='', params='',
admin=True, fail_ok=False):
"""Executes given command with auth attributes appended."""
diff --git a/cli/simple_read_only/test_compute.py b/cli/simple_read_only/test_compute.py
index bcdd2c5..e1109ff 100644
--- a/cli/simple_read_only/test_compute.py
+++ b/cli/simple_read_only/test_compute.py
@@ -56,12 +56,13 @@
def test_admin_absolute_limites(self):
self.nova('absolute-limits')
+ self.nova('absolute-limits', params='--reserved')
def test_admin_aggregate_list(self):
self.nova('aggregate-list')
def test_admin_availability_zone_list(self):
- self.nova('availability-zone-list')
+ self.assertIn("internal", self.nova('availability-zone-list'))
def test_admin_cloudpipe_list(self):
self.nova('cloudpipe-list')
@@ -90,7 +91,7 @@
params='--flavor m1.tiny')
def test_admin_flavor_list(self):
- self.nova('flavor-list')
+ self.assertIn("Memory_MB", self.nova('flavor-list'))
def test_admin_floating_ip_bulk_list(self):
self.nova('floating-ip-bulk-list')
diff --git a/cli/simple_read_only/test_compute_manage.py b/cli/simple_read_only/test_compute_manage.py
new file mode 100644
index 0000000..17b3bf6
--- /dev/null
+++ b/cli/simple_read_only/test_compute_manage.py
@@ -0,0 +1,61 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import logging
+import subprocess
+
+import testtools
+
+import cli
+
+
+LOG = logging.getLogger(__name__)
+
+
+class SimpleReadOnlyNovaManageTest(cli.ClientTestBase):
+
+ """
+ This is a first pass at a simple read only nova-manage test. This
+ only exercises client commands that are read only.
+
+ This should test commands:
+ * with and without optional parameters
+ * initially just check return codes, and later test command outputs
+
+ """
+
+ def test_admin_fake_action(self):
+ self.assertRaises(subprocess.CalledProcessError,
+ self.nova_manage,
+ 'this-does-nova-exist')
+
+ #NOTE(jogo): Commands in order listed in 'nova-manage -h'
+
+ # test flags
+ def test_help_flag(self):
+ self.nova_manage('', '-h')
+
+ @testtools.skip("version is empty, bug 1138844")
+ def test_version_flag(self):
+ self.assertNotEqual("", self.nova_manage('', '--version'))
+
+ # test actions
+ def test_version(self):
+ self.assertNotEqual("", self.nova_manage('version'))
+
+ def test_flavor_list(self):
+ self.assertNotEqual("", self.nova_manage('flavor list'))