-
Notifications
You must be signed in to change notification settings - Fork 3
Shipyard GET API Tests #3
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,7 +144,7 @@ def no_rbac_rule_validation_decorator(physical_line, filename): | |
""" | ||
global have_rbac_decorator | ||
|
||
if ("airship_tempest_plugin/tests/api/rbac" in filename or | ||
if ("airship_tempest_plugin/tests/api/shipyard/rbac" in filename or | ||
"airship_tempest_plugin/tests/scenario" in filename): | ||
|
||
if RULE_VALIDATION_DECORATOR.match(physical_line): | ||
|
@@ -163,7 +163,7 @@ def no_rbac_suffix_in_test_filename(filename): | |
"""Check that RBAC filenames end with "_rbac" suffix. | ||
P101 | ||
""" | ||
if "airship_tempest_plugin/tests/api" in filename: | ||
if "airship_tempest_plugin/tests/api/shipyard/rbac" in filename: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it shouldn't be just for shipyard as more rbac tests for other services could be added later There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is added to bypass the naming convention validation for the function tests; Naming convention validation would be applicable for all rbac tests only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, but maybe use regex so it is not hardcoded to only shipyard. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this still needs to be updated. nothing here should be hardcoded to shipyard |
||
|
||
if filename.endswith('rbac_base.py'): | ||
return | ||
|
@@ -176,7 +176,7 @@ def no_rbac_test_suffix_in_test_class_name(physical_line, filename): | |
"""Check that RBAC class names end with "RbacTest" | ||
P102 | ||
""" | ||
if "airship_tempest_plugin/tests/api/rbac/" in filename: | ||
if "airship_tempest_plugin/tests/api/shipyard/rbac" in filename: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it shouldn't be just for shipyard as more rbac tests for other services could be added later There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is added to bypass the naming convention validation for function tests; Naming convention validation would be applicable for all rbac tests only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, but maybe use regex so it is not hardcoded to only shipyard. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this still needs to be updated. nothing here should be hardcoded to shipyard |
||
|
||
if filename.endswith('rbac_base.py'): | ||
return | ||
|
@@ -190,7 +190,7 @@ def no_client_alias_in_test_cases(logical_line, filename): | |
"""Check that test cases don't use "self.client" to define a client. | ||
P103 | ||
""" | ||
if "airship_tempest_plugin/tests/api" in filename: | ||
if "airship_tempest_plugin/tests/api/" in filename: | ||
if "self.client" in logical_line or "cls.client" in logical_line: | ||
return 0, "Do not use 'self.client' as a service client alias" | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,9 @@ | |
""" | ||
|
||
from oslo_serialization import jsonutils as json | ||
|
||
from tempest.lib.common import rest_client | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the extra line needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra line is removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see it as removed. Perhaps I am not seeing the latest updates made? |
||
# NOTE(rb560u): The following will need to be rewritten in the future if | ||
# functional testing is desired: | ||
# - 'def create_configdocs` | ||
|
@@ -37,7 +37,10 @@ def get_configdocs_status(self): | |
resp, body = self.get('configdocs') | ||
self.expected_success(200, resp.status) | ||
body = json.loads(body) | ||
return rest_client.ResponseBody(resp, body) | ||
if isinstance(body, list): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this needing when doing a get on a specific artifact/resource? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is returning a List only; therefore used "ResponseBodyList". |
||
return rest_client.ResponseBodyList(resp, body) | ||
else: | ||
return rest_client.ResponseBody(resp, body) | ||
|
||
def create_configdocs(self, collection_id=None): | ||
url = "configdocs/%s" % collection_id | ||
|
@@ -52,17 +55,43 @@ def get_configdocs(self, collection_id=None): | |
resp, body = self.get('configdocs/%s' % collection_id) | ||
self.expected_success(200, resp.status) | ||
body = json.loads(body) | ||
return rest_client.ResponseBody(resp, body) | ||
if isinstance(body, list): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this needing when doing a get on a specific artifact/resource? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is returning a List only; therefore used "ResponseBodyList". |
||
return rest_client.ResponseBodyList(resp, body) | ||
else: | ||
return rest_client.ResponseBody(resp, body) | ||
|
||
def get_configdocs_version(self, collection_id=None, version_arg=None): | ||
resp, body = self.get('configdocs/%s?version=%s' % | ||
(collection_id, version_arg)) | ||
self.expected_success(200, resp.status) | ||
return rest_client.ResponseBodyData(resp, body) | ||
|
||
def get_renderedconfigdocs(self): | ||
resp, body = self.get('renderedconfigdocs') | ||
self.expected_success(200, resp.status) | ||
body = json.loads(body) | ||
return rest_client.ResponseBody(resp, body) | ||
if isinstance(body, list): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this needing when doing a get on a specific artifact/resource? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is returning a List only; therefore used "ResponseBodyList". |
||
return rest_client.ResponseBodyList(resp, body) | ||
else: | ||
return rest_client.ResponseBody(resp, body) | ||
|
||
def get_renderedconfigdocs_version(self, version_arg=None): | ||
resp, body = self.get('renderedconfigdocs?version=%s' % version_arg) | ||
self.expected_success(200, resp.status) | ||
return rest_client.ResponseBodyData(resp, body) | ||
|
||
def commit_configdocs(self, force=False, dryrun=False): | ||
post_body = json.dumps({"force": force, "dryrun": dryrun}) | ||
resp, body = self.post("commitconfigdocs", post_body) | ||
self.expected_success(200, resp.status) | ||
body = json.loads(body) | ||
return rest_client.ResponseBody(resp, body) | ||
|
||
def get_configdocs_compare_two(self, version_arg=None): | ||
resp, body = self.get('configdocs?%s' % version_arg) | ||
self.expected_success(200, resp.status) | ||
body = json.loads(body) | ||
if isinstance(body, list): | ||
return rest_client.ResponseBodyList(resp, body) | ||
else: | ||
return rest_client.ResponseBody(resp, body) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 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 AirflowMonitoringTest(base.BaseShipyardTest): | ||
def _get_workflows_id(self): | ||
resp = self.shipyard_airflow_monitoring_client.list_workflows() | ||
self.assertTrue(len(resp[0]) > 0, | ||
'No configdocs available, nothing to test') | ||
return resp[0]['workflow_id'] | ||
|
||
@decorators.idempotent_id('5a41bb54-c010-4d09-9d68-eece565e66f3') | ||
def test_get_workflows_list(self): | ||
"""List of workflows, Successful with response status 200""" | ||
response = self.shipyard_airflow_monitoring_client.list_workflows() | ||
self.assertEqual(response.response['status'], '200') | ||
|
||
@decorators.idempotent_id('7e4fb56b-6637-48bf-808d-c166ee5f804f') | ||
def test_get_workflow(self): | ||
"""A particular workflow detail, Successful with response status 200""" | ||
workflow_id = self._get_workflows_id() | ||
response = self.shipyard_airflow_monitoring_client. \ | ||
get_workflow(workflow_id) | ||
self.assertEqual(response.response['status'], '200') | ||
self.assertEqual(response['workflow_id'], workflow_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it shouldn't be just for shipyard as more rbac tests for other services could be added later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is added to bypass the naming convention validation for function tests; Naming convention validation would be applicable for all rbac tests only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, but maybe use regex so it is not hardcoded to only shipyard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this still needs to be updated. nothing here should be hardcoded to shipyard