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.
This commit is contained in:
parent
447f620765
commit
5a7e5c7cbf
@ -144,7 +144,7 @@ def no_rbac_rule_validation_decorator(physical_line, filename):
|
|||||||
"""
|
"""
|
||||||
global have_rbac_decorator
|
global have_rbac_decorator
|
||||||
|
|
||||||
if ("airship_tempest_plugin/tests/api" in filename or
|
if ("airship_tempest_plugin/tests/api/rbac" in filename or
|
||||||
"airship_tempest_plugin/tests/scenario" in filename):
|
"airship_tempest_plugin/tests/scenario" in filename):
|
||||||
|
|
||||||
if RULE_VALIDATION_DECORATOR.match(physical_line):
|
if RULE_VALIDATION_DECORATOR.match(physical_line):
|
||||||
@ -176,7 +176,7 @@ def no_rbac_test_suffix_in_test_class_name(physical_line, filename):
|
|||||||
"""Check that RBAC class names end with "RbacTest"
|
"""Check that RBAC class names end with "RbacTest"
|
||||||
P102
|
P102
|
||||||
"""
|
"""
|
||||||
if "airship_tempest_plugin/tests/api" in filename:
|
if "airship_tempest_plugin/tests/api/rbac/" in filename:
|
||||||
|
|
||||||
if filename.endswith('rbac_base.py'):
|
if filename.endswith('rbac_base.py'):
|
||||||
return
|
return
|
||||||
|
57
airship_tempest_plugin/tests/api/shipyard/test_actions.py
Normal file
57
airship_tempest_plugin/tests/api/shipyard/test_actions.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# Copyright 2018 AT&T Corp
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
from airship_tempest_plugin.tests.api.shipyard import base
|
||||||
|
|
||||||
|
from tempest.lib import decorators
|
||||||
|
|
||||||
|
|
||||||
|
class ActionsTest(base.BaseShipyardTest):
|
||||||
|
|
||||||
|
def _get_action_id(self):
|
||||||
|
resp = self.shipyard_actions_client.list_actions()
|
||||||
|
self.assertTrue(len(resp[1]) > 0,
|
||||||
|
'No actions available, nothing to test')
|
||||||
|
# get the response body
|
||||||
|
return resp[1]['id']
|
||||||
|
|
||||||
|
def _get_action_step_id(self):
|
||||||
|
resp = self.shipyard_actions_client.list_actions()
|
||||||
|
self.assertTrue(len(resp[1]) > 0,
|
||||||
|
'No actions available, nothing to test')
|
||||||
|
return resp[1]['id'], resp[1]['steps'][0]['id']
|
||||||
|
|
||||||
|
@decorators.idempotent_id('94901561-7ad1-4e9c-8df8-afe3a7f63c09')
|
||||||
|
def test_list_actions(self):
|
||||||
|
"""List of actions, Successful with response status 200"""
|
||||||
|
resp = self.shipyard_actions_client.list_actions()
|
||||||
|
self.assertTrue(len(resp[1]) > 0,
|
||||||
|
'No actions available, nothing to test')
|
||||||
|
self.assertEqual(resp.response['status'], '200')
|
||||||
|
|
||||||
|
@decorators.idempotent_id('b0d4c23a-d3a4-4a12-8e10-ac6f8a98d33e')
|
||||||
|
def test_get_action(self):
|
||||||
|
action_id = self._get_action_id()
|
||||||
|
"""Get actions, Successful with response status 200"""
|
||||||
|
resp = self.shipyard_actions_client.get_action(action_id)
|
||||||
|
self.assertEqual(resp.response['status'], '200')
|
||||||
|
|
||||||
|
@decorators.idempotent_id('a8bc9e6b-bfa3-4635-a1ec-0b9ddc9cb03f')
|
||||||
|
def test_get_action_step(self):
|
||||||
|
"""Get actions step, Successful with response status 200"""
|
||||||
|
action_id, step_id = self._get_action_step_id()
|
||||||
|
resp = self.shipyard_actions_client.get_action_step(action_id, step_id)
|
||||||
|
self.assertEqual(resp.response['status'], '200')
|
Loading…
Reference in New Issue
Block a user