From 27cd393028a103d8d52cf25f035e3a2985572ccb Mon Sep 17 00:00:00 2001
From: Joe Gordon <joe.gordon0@gmail.com>
Date: Wed, 28 Jan 2015 16:04:26 -0800
Subject: [PATCH] Copy functional tests from tempest cli read only

Copy tests in from tempest/cli/simple_read_only/compute/test_nova.py in
preparation for removing that file.

Change-Id: I5a34cf1a39d4f73f94a27cce365434bd4a0eea0b
---
 .../tests/functional/test_readonly_nova.py    | 136 ++++++++++++++++--
 test-requirements.txt                         |   2 +-
 2 files changed, 129 insertions(+), 9 deletions(-)

diff --git a/novaclient/tests/functional/test_readonly_nova.py b/novaclient/tests/functional/test_readonly_nova.py
index bc0589780..2ea4ec986 100644
--- a/novaclient/tests/functional/test_readonly_nova.py
+++ b/novaclient/tests/functional/test_readonly_nova.py
@@ -10,6 +10,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest_lib import decorators
 from tempest_lib import exceptions
 
 from novaclient.tests.functional import base
@@ -18,15 +19,9 @@ from novaclient.tests.functional import base
 class SimpleReadOnlyNovaClientTest(base.ClientTestBase):
 
     """
-    This is a first pass at a simple read only python-novaclient test. This
-    only exercises client commands that are read only.
-
-    This should test commands:
-    * as a regular user
-    * as a admin user
-    * with and without optional parameters
-    * initially just check return codes, and later test command outputs
+    read only functional python-novaclient tests.
 
+    This only exercises client commands that are read only.
     """
 
     def test_admin_fake_action(self):
@@ -36,6 +31,131 @@ class SimpleReadOnlyNovaClientTest(base.ClientTestBase):
 
     # NOTE(jogo): Commands in order listed in 'nova help'
 
+    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.assertIn("internal", self.nova('availability-zone-list'))
+
+    def test_admin_cloudpipe_list(self):
+        self.nova('cloudpipe-list')
+
+    def test_admin_credentials(self):
+        self.nova('credentials')
+
+    # "Neutron does not provide this feature"
+    def test_admin_dns_domains(self):
+        self.nova('dns-domains')
+
+    @decorators.skip_because(bug="1157349")
+    def test_admin_dns_list(self):
+        self.nova('dns-list')
+
+    def test_admin_endpoints(self):
+        self.nova('endpoints')
+
+    def test_admin_flavor_acces_list(self):
+        self.assertRaises(exceptions.CommandFailed,
+                          self.nova,
+                          'flavor-access-list')
+        # Failed to get access list for public flavor type
+        self.assertRaises(exceptions.CommandFailed,
+                          self.nova,
+                          'flavor-access-list',
+                          params='--flavor m1.tiny')
+
+    def test_admin_flavor_list(self):
+        self.assertIn("Memory_MB", self.nova('flavor-list'))
+
+    def test_admin_floating_ip_bulk_list(self):
+        self.nova('floating-ip-bulk-list')
+
+    def test_admin_floating_ip_list(self):
+        self.nova('floating-ip-list')
+
+    def test_admin_floating_ip_pool_list(self):
+        self.nova('floating-ip-pool-list')
+
+    def test_admin_host_list(self):
+        self.nova('host-list')
+
+    def test_admin_hypervisor_list(self):
+        self.nova('hypervisor-list')
+
+    def test_admin_image_list(self):
+        self.nova('image-list')
+
+    @decorators.skip_because(bug="1157349")
+    def test_admin_interface_list(self):
+        self.nova('interface-list')
+
+    def test_admin_keypair_list(self):
+        self.nova('keypair-list')
+
+    def test_admin_list(self):
+        self.nova('list')
+        self.nova('list', params='--all-tenants 1')
+        self.nova('list', params='--all-tenants 0')
+        self.assertRaises(exceptions.CommandFailed,
+                          self.nova,
+                          'list',
+                          params='--all-tenants bad')
+
+    def test_admin_network_list(self):
+        self.nova('network-list')
+
+    def test_admin_rate_limits(self):
+        self.nova('rate-limits')
+
+    def test_admin_secgroup_list(self):
+        self.nova('secgroup-list')
+
+    @decorators.skip_because(bug="1157349")
+    def test_admin_secgroup_list_rules(self):
+        self.nova('secgroup-list-rules')
+
+    def test_admin_server_group_list(self):
+        self.nova('server-group-list')
+
+    def test_admin_servce_list(self):
+        self.nova('service-list')
+
+    def test_admin_usage(self):
+        self.nova('usage')
+
+    def test_admin_usage_list(self):
+        self.nova('usage-list')
+
+    def test_admin_volume_list(self):
+        self.nova('volume-list')
+
+    def test_admin_volume_snapshot_list(self):
+        self.nova('volume-snapshot-list')
+
+    def test_admin_volume_type_list(self):
+        self.nova('volume-type-list')
+
+    def test_admin_help(self):
+        self.nova('help')
+
+    def test_admin_list_extensions(self):
+        self.nova('list-extensions')
+
+    def test_admin_net_list(self):
+        self.nova('net-list')
+
+    def test_agent_list(self):
+        self.nova('agent-list')
+        self.nova('agent-list', flags='--debug')
+
+    def test_migration_list(self):
+        self.nova('migration-list')
+        self.nova('migration-list', flags='--debug')
+
     # Optional arguments:
 
     def test_admin_version(self):
diff --git a/test-requirements.txt b/test-requirements.txt
index f15d3beac..051ced393 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -14,4 +14,4 @@ oslosphinx>=2.2.0  # Apache-2.0
 testrepository>=0.0.18
 testscenarios>=0.4
 testtools>=0.9.36,!=1.2.0
-tempest-lib>=0.1.0
+tempest-lib>=0.2.0