summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPradeep Kumar <pradeep.sreenivas@gmail.com>2018-10-01 04:28:19 -0500
committerRick Bartra <rb560u@tt.com>2018-10-03 12:03:38 -0400
commit5a7e5c7cbf5f59e4251d4941f1590fd9e3e7ae18 (patch)
tree072bbcaab24af0f2e8c242a77fed14c5369f5bf3
parent447f6207654608448a439ed483968bbe2b76f2d2 (diff)
Shipyard Actions API Tests
Add tests for the following: - list actions - get action - get action step This commit also updates the hacking checks.py to differentiate between RBAC directories and non-RBAC directories.
-rw-r--r--airship_tempest_plugin/hacking/checks.py4
-rw-r--r--airship_tempest_plugin/tests/api/shipyard/test_actions.py57
2 files changed, 59 insertions, 2 deletions
diff --git a/airship_tempest_plugin/hacking/checks.py b/airship_tempest_plugin/hacking/checks.py
index 1491f2d..7108543 100644
--- a/airship_tempest_plugin/hacking/checks.py
+++ b/airship_tempest_plugin/hacking/checks.py
@@ -144,7 +144,7 @@ def no_rbac_rule_validation_decorator(physical_line, filename):
144 """ 144 """
145 global have_rbac_decorator 145 global have_rbac_decorator
146 146
147 if ("airship_tempest_plugin/tests/api" in filename or 147 if ("airship_tempest_plugin/tests/api/rbac" in filename or
148 "airship_tempest_plugin/tests/scenario" in filename): 148 "airship_tempest_plugin/tests/scenario" in filename):
149 149
150 if RULE_VALIDATION_DECORATOR.match(physical_line): 150 if RULE_VALIDATION_DECORATOR.match(physical_line):
@@ -176,7 +176,7 @@ def no_rbac_test_suffix_in_test_class_name(physical_line, filename):
176 """Check that RBAC class names end with "RbacTest" 176 """Check that RBAC class names end with "RbacTest"
177 P102 177 P102
178 """ 178 """
179 if "airship_tempest_plugin/tests/api" in filename: 179 if "airship_tempest_plugin/tests/api/rbac/" in filename:
180 180
181 if filename.endswith('rbac_base.py'): 181 if filename.endswith('rbac_base.py'):
182 return 182 return
diff --git a/airship_tempest_plugin/tests/api/shipyard/test_actions.py b/airship_tempest_plugin/tests/api/shipyard/test_actions.py
new file mode 100644
index 0000000..272d225
--- /dev/null
+++ b/airship_tempest_plugin/tests/api/shipyard/test_actions.py
@@ -0,0 +1,57 @@
1# Copyright 2018 AT&T Corp
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15#
16
17from airship_tempest_plugin.tests.api.shipyard import base
18
19from tempest.lib import decorators
20
21
22class ActionsTest(base.BaseShipyardTest):
23
24 def _get_action_id(self):
25 resp = self.shipyard_actions_client.list_actions()
26 self.assertTrue(len(resp[1]) > 0,
27 'No actions available, nothing to test')
28 # get the response body
29 return resp[1]['id']
30
31 def _get_action_step_id(self):
32 resp = self.shipyard_actions_client.list_actions()
33 self.assertTrue(len(resp[1]) > 0,
34 'No actions available, nothing to test')
35 return resp[1]['id'], resp[1]['steps'][0]['id']
36
37 @decorators.idempotent_id('94901561-7ad1-4e9c-8df8-afe3a7f63c09')
38 def test_list_actions(self):
39 """List of actions, Successful with response status 200"""
40 resp = self.shipyard_actions_client.list_actions()
41 self.assertTrue(len(resp[1]) > 0,
42 'No actions available, nothing to test')
43 self.assertEqual(resp.response['status'], '200')
44
45 @decorators.idempotent_id('b0d4c23a-d3a4-4a12-8e10-ac6f8a98d33e')
46 def test_get_action(self):
47 action_id = self._get_action_id()
48 """Get actions, Successful with response status 200"""
49 resp = self.shipyard_actions_client.get_action(action_id)
50 self.assertEqual(resp.response['status'], '200')
51
52 @decorators.idempotent_id('a8bc9e6b-bfa3-4635-a1ec-0b9ddc9cb03f')
53 def test_get_action_step(self):
54 """Get actions step, Successful with response status 200"""
55 action_id, step_id = self._get_action_step_id()
56 resp = self.shipyard_actions_client.get_action_step(action_id, step_id)
57 self.assertEqual(resp.response['status'], '200')