diff options
Diffstat (limited to 'heatclient/tests/test_shell.py')
-rw-r--r-- | heatclient/tests/test_shell.py | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/heatclient/tests/test_shell.py b/heatclient/tests/test_shell.py index d5808c2..088fd81 100644 --- a/heatclient/tests/test_shell.py +++ b/heatclient/tests/test_shell.py @@ -143,12 +143,6 @@ class ShellParamValidationTest(TestCase): ('stack-update', dict( command='stack-update ts -P "a-b"', err='Malformed parameter')), - ('validate', dict( - command='validate -P "a=b;c"', - err='Malformed parameter')), - ('template-validate', dict( - command='template-validate -P "a$b"', - err='Malformed parameter')), ] def setUp(self): @@ -397,6 +391,8 @@ class ShellTestUserPass(ShellBase): 'limit': 2, 'status': ['COMPLETE', 'FAILED'], 'marker': 'fake_id', + 'global_tenant': True, + 'show_deleted': 'True', }, True) fakes.script_heat_list(expected_url) @@ -406,7 +402,9 @@ class ShellTestUserPass(ShellBase): ' --limit 2' ' --marker fake_id' ' --filters=status=COMPLETE' - ' --filters=status=FAILED') + ' --filters=status=FAILED' + ' --global-tenant' + ' --show-deleted') required = [ 'teststack', @@ -858,7 +856,8 @@ class ShellTestUserPass(ShellBase): 'LinuxDistribution': 'F17"', '"InstanceType': 'm1.large', 'DBPassword': 'verybadpassword'}, - 'timeout_mins': 123} + 'timeout_mins': 123, + 'disable_rollback': True} http.HTTPClient.json_request( 'PUT', '/stacks/teststack2/2', data=expected_data, @@ -1037,6 +1036,7 @@ class ShellTestUserPass(ShellBase): update_text = self.shell( 'stack-update teststack2/2 ' '--template-file=%s ' + '--enable-rollback ' '--parameters="InstanceType=m1.large;DBUsername=wp;' 'DBPassword=verybadpassword;KeyName=heat_key;' 'LinuxDistribution=F17"' % template_file) @@ -1311,21 +1311,22 @@ class ShellTestResources(ShellBase): def _script_keystone_client(self): fakes.script_keystone_client() - def test_resource_list(self): + def _test_resource_list(self, with_resource_name): self._script_keystone_client() resp_dict = {"resources": [ {"links": [{"href": "http://heat.example.com:8004/foo", "rel": "self"}, {"href": "http://heat.example.com:8004/foo2", "rel": "resource"}], - "logical_resource_id": "aResource", + "logical_resource_id": "aLogicalResource", "physical_resource_id": "43b68bae-ed5d-4aed-a99f-0b3d39c2418a", - "resource_name": "aResource", "resource_status": "CREATE_COMPLETE", "resource_status_reason": "state changed", "resource_type": "OS::Nova::Server", "updated_time": "2014-01-06T16:14:26Z"}]} + if with_resource_name: + resp_dict["resources"][0]["resource_name"] = "aResource" resp = fakes.FakeHTTPResponse( 200, 'OK', @@ -1341,18 +1342,53 @@ class ShellTestResources(ShellBase): resource_list_text = self.shell('resource-list {0}'.format(stack_id)) required = [ - 'resource_name', 'resource_type', 'resource_status', 'updated_time', - 'aResource', 'OS::Nova::Server', 'CREATE_COMPLETE', '2014-01-06T16:14:26Z' ] + if with_resource_name: + required.append('resource_name') + required.append('aResource') + else: + required.append('logical_resource_id') + required.append("aLogicalResource") + for r in required: self.assertRegexpMatches(resource_list_text, r) + def test_resource_list(self): + self._test_resource_list(True) + + def test_resource_list_no_resource_name(self): + self._test_resource_list(False) + + def test_resource_list_empty(self): + self._script_keystone_client() + resp_dict = {"resources": []} + resp = fakes.FakeHTTPResponse( + 200, + 'OK', + {'content-type': 'application/json'}, + jsonutils.dumps(resp_dict)) + stack_id = 'teststack/1' + http.HTTPClient.json_request( + 'GET', '/stacks/%s/resources' % ( + stack_id)).AndReturn((resp, resp_dict)) + + self.m.ReplayAll() + + resource_list_text = self.shell('resource-list {0}'.format(stack_id)) + + self.assertEqual('''\ ++---------------+---------------+-----------------+--------------+ +| resource_name | resource_type | resource_status | updated_time | ++---------------+---------------+-----------------+--------------+ ++---------------+---------------+-----------------+--------------+ +''', resource_list_text) + def test_resource_show(self): self._script_keystone_client() resp_dict = {"resource": |