Browse Source

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.
Pradeep Kumar 6 months ago
parent
commit
5a7e5c7cbf

+ 2
- 2
airship_tempest_plugin/hacking/checks.py View File

@@ -144,7 +144,7 @@ def no_rbac_rule_validation_decorator(physical_line, filename):
144 144
     """
145 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 148
             "airship_tempest_plugin/tests/scenario" in filename):
149 149
 
150 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 176
     """Check that RBAC class names end with "RbacTest"
177 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 181
         if filename.endswith('rbac_base.py'):
182 182
             return

+ 57
- 0
airship_tempest_plugin/tests/api/shipyard/test_actions.py View File

@@ -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
+
17
+from airship_tempest_plugin.tests.api.shipyard import base
18
+
19
+from tempest.lib import decorators
20
+
21
+
22
+class 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')

Loading…
Cancel
Save