Defect fix for Shipyard Client list/get API
Fixing issues with shipyard api client to check if the instance is a list or a dictionary. Change-Id: I5fe26dc1a6fd67ff6edfeb8314bb976e2d2125f9
This commit is contained in:
parent
7d1b41e644
commit
80f13a28ac
|
@ -20,7 +20,7 @@ http://airship-shipyard.readthedocs.io/en/latest/API.html#action-api
|
|||
|
||||
from oslo_serialization import jsonutils as json
|
||||
|
||||
from tempest.lib.common import rest_client
|
||||
from airship_tempest_plugin.services.shipyard.json import base
|
||||
|
||||
# NOTE(rb560u): The following will need to be rewritten in the future if
|
||||
# functional testing is desired:
|
||||
|
@ -30,14 +30,13 @@ from tempest.lib.common import rest_client
|
|||
# role permission to that API.
|
||||
|
||||
|
||||
class ActionsClient(rest_client.RestClient):
|
||||
api_version = "v1.0"
|
||||
class ActionsClient(base.BaseClient):
|
||||
|
||||
def list_actions(self):
|
||||
resp, body = self.get('actions')
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
return self.response_obj_or_list(resp, body)
|
||||
|
||||
def create_action(self, action=None):
|
||||
url = 'actions'
|
||||
|
|
|
@ -20,17 +20,16 @@ http://airship-shipyard.readthedocs.io/en/latest/API.html#airflow-monitoring-api
|
|||
|
||||
from oslo_serialization import jsonutils as json
|
||||
|
||||
from tempest.lib.common import rest_client
|
||||
from airship_tempest_plugin.services.shipyard.json import base
|
||||
|
||||
|
||||
class AirflowMonitoringClient(rest_client.RestClient):
|
||||
api_version = "v1.0"
|
||||
class AirflowMonitoringClient(base.BaseClient):
|
||||
|
||||
def list_workflows(self):
|
||||
resp, body = self.get('workflows')
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
return self.response_obj_or_list(resp, body)
|
||||
|
||||
def get_workflow(self, workflow_id=None):
|
||||
resp, body = self.get('workflows/%s' % workflow_id)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from tempest.lib.common import rest_client
|
||||
|
||||
|
||||
class BaseClient(rest_client.RestClient):
|
||||
|
||||
api_version = "v1.0"
|
||||
|
||||
def response_obj_or_list(resp, body):
|
||||
if isinstance(body, list):
|
||||
return rest_client.ResponseBodyList(resp, body)
|
||||
else:
|
||||
return rest_client.ResponseBody(resp, body)
|
|
@ -20,7 +20,7 @@ http://airship-shipyard.readthedocs.io/en/latest/API.html#document-staging-api
|
|||
|
||||
from oslo_serialization import jsonutils as json
|
||||
|
||||
from tempest.lib.common import rest_client
|
||||
from airship_tempest_plugin.services.shipyard.json import base
|
||||
|
||||
# NOTE(rb560u): The following will need to be rewritten in the future if
|
||||
# functional testing is desired:
|
||||
|
@ -30,14 +30,13 @@ from tempest.lib.common import rest_client
|
|||
# role permission to that API.
|
||||
|
||||
|
||||
class DocumentStagingClient(rest_client.RestClient):
|
||||
api_version = "v1.0"
|
||||
class DocumentStagingClient(base.BaseClient):
|
||||
|
||||
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)
|
||||
return self.response_obj_or_list(resp, body)
|
||||
|
||||
def create_configdocs(self, collection_id=None):
|
||||
url = "configdocs/%s" % collection_id
|
||||
|
@ -52,13 +51,13 @@ class DocumentStagingClient(rest_client.RestClient):
|
|||
resp, body = self.get('configdocs/%s' % collection_id)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
return self.response_obj_or_list(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)
|
||||
return self.response_obj_or_list(resp, body)
|
||||
|
||||
def commit_configdocs(self, force=False, dryrun=False):
|
||||
post_body = json.dumps({"force": force, "dryrun": dryrun})
|
||||
|
|
|
@ -20,15 +20,14 @@ http://airship-shipyard.readthedocs.io/en/latest/API.html#airflow-monitoring-api
|
|||
|
||||
from oslo_serialization import jsonutils as json
|
||||
|
||||
from tempest.lib.common import rest_client
|
||||
from airship_tempest_plugin.services.shipyard.json import base
|
||||
|
||||
|
||||
class LogRetrievalClient(rest_client.RestClient):
|
||||
api_version = "v1.0"
|
||||
class LogRetrievalClient(base.BaseClient):
|
||||
|
||||
def get_action_step_logs(self, action_id=None, step_id=None):
|
||||
resp, body = \
|
||||
self.get('actions/%s/steps/%s/logs' % (action_id, step_id))
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
return rest_client.ResponseBodyData(resp, body)
|
||||
|
|
|
@ -20,11 +20,10 @@ https://github.com/openstack/airship-shipyard/blob/master/docs/source/API.rst#si
|
|||
|
||||
from oslo_serialization import jsonutils as json
|
||||
|
||||
from tempest.lib.common import rest_client
|
||||
from airship_tempest_plugin.services.shipyard.json import base
|
||||
|
||||
|
||||
class SiteStatusesClient(rest_client.RestClient):
|
||||
api_version = "v1.0"
|
||||
class SiteStatusesClient(base.BaseClient):
|
||||
|
||||
# Note: add support of query filters if testing beyond RBAC is desired
|
||||
def get_site_statuses(self):
|
||||
|
|
Loading…
Reference in New Issue