Remove some pycharm warnings
* Mutable default arg * Use of reserved names as parameters * Missing requirements * Unused parameters * use static method * Doc errors Change-Id: Iaf7efa263398005ba1fa7261c894c85cb2fbcf47
This commit is contained in:
parent
cc3455b732
commit
f0d3f2e092
@ -23,7 +23,6 @@ sys.path.insert(0, os.path.abspath('../..'))
|
|||||||
extensions = [
|
extensions = [
|
||||||
'sphinx.ext.autodoc',
|
'sphinx.ext.autodoc',
|
||||||
'openstackdocstheme',
|
'openstackdocstheme',
|
||||||
#'sphinx.ext.intersphinx',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# autodoc generation is a bit aggressive and a nuisance when doing heavy
|
# autodoc generation is a bit aggressive and a nuisance when doing heavy
|
||||||
@ -78,4 +77,4 @@ latex_documents = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Example configuration for intersphinx: refer to the Python standard library.
|
# Example configuration for intersphinx: refer to the Python standard library.
|
||||||
#intersphinx_mapping = {'http://docs.python.org/': None}
|
# intersphinx_mapping = {'http://docs.python.org/': None}
|
||||||
|
@ -11,3 +11,4 @@ At the command line::
|
|||||||
$ git clone https://opendev.org/openstack/mistral-tempest-plugin
|
$ git clone https://opendev.org/openstack/mistral-tempest-plugin
|
||||||
$ cd mistral-tempest-plugin/
|
$ cd mistral-tempest-plugin/
|
||||||
$ pip install -e .
|
$ pip install -e .
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ Alternatively, to run mistral tempest plugin tests using tox, go to tempest dire
|
|||||||
And, to run a specific test::
|
And, to run a specific test::
|
||||||
|
|
||||||
$ tox -eall-plugin mistral_tempest_tests.tests.api.v2.test_mistral_basic_v2.WorkbookTestsV2.test_get_workbook
|
$ tox -eall-plugin mistral_tempest_tests.tests.api.v2.test_mistral_basic_v2.WorkbookTestsV2.test_get_workbook
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ class MistralClientBase(rest_client.RestClient):
|
|||||||
|
|
||||||
return self.delete('{obj}/{name}'.format(obj=obj, name=name))
|
return self.delete('{obj}/{name}'.format(obj=obj, name=name))
|
||||||
|
|
||||||
def get_object(self, obj, id):
|
def get_object(self, obj, _id):
|
||||||
resp, body = self.get('{obj}/{id}'.format(obj=obj, id=id))
|
resp, body = self.get('{obj}/{id}'.format(obj=obj, id=_id))
|
||||||
|
|
||||||
return resp, jsonutils.loads(body)
|
return resp, jsonutils.loads(body)
|
||||||
|
|
||||||
|
@ -37,7 +37,9 @@ class MistralClientV2(base.MistralClientBase):
|
|||||||
|
|
||||||
return self.get(url_path, headers=headers)
|
return self.get(url_path, headers=headers)
|
||||||
|
|
||||||
def post_json(self, url_path, obj, extra_headers={}):
|
def post_json(self, url_path, obj, extra_headers=None):
|
||||||
|
if extra_headers is None:
|
||||||
|
extra_headers = {}
|
||||||
headers = {"Content-Type": "application/json"}
|
headers = {"Content-Type": "application/json"}
|
||||||
headers = dict(headers, **extra_headers)
|
headers = dict(headers, **extra_headers)
|
||||||
return self.post(url_path,
|
return self.post(url_path,
|
||||||
@ -195,7 +197,9 @@ class MistralClientV2(base.MistralClientBase):
|
|||||||
|
|
||||||
return [t for t in all_tasks if t['workflow_name'] == wf_name]
|
return [t for t in all_tasks if t['workflow_name'] == wf_name]
|
||||||
|
|
||||||
def create_action_execution(self, request_body, extra_headers={}):
|
def create_action_execution(self, request_body, extra_headers=None):
|
||||||
|
if extra_headers is None:
|
||||||
|
extra_headers = {}
|
||||||
resp, body = self.post_json('action_executions', request_body,
|
resp, body = self.post_json('action_executions', request_body,
|
||||||
extra_headers)
|
extra_headers)
|
||||||
|
|
||||||
|
@ -244,9 +244,6 @@ class ActionExecutionTestsV2(base.TestCase):
|
|||||||
'action_executions?include_output=true&task_execution_id=%s' %
|
'action_executions?include_output=true&task_execution_id=%s' %
|
||||||
task_id)
|
task_id)
|
||||||
|
|
||||||
self.assertEqual(200, resp.status)
|
|
||||||
action_execution = body['action_executions'][0]
|
|
||||||
|
|
||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
action_execution = body['action_executions'][0]
|
action_execution = body['action_executions'][0]
|
||||||
self.assertEqual(wf_namespace, action_execution['workflow_namespace'])
|
self.assertEqual(wf_namespace, action_execution['workflow_namespace'])
|
||||||
|
@ -24,7 +24,8 @@ class ActionTestsV2(base.TestCase):
|
|||||||
|
|
||||||
_service = 'workflowv2'
|
_service = 'workflowv2'
|
||||||
|
|
||||||
def get_field_value(self, body, act_name, field):
|
@staticmethod
|
||||||
|
def get_field_value(body, act_name, field):
|
||||||
return [body['actions'][i][field]
|
return [body['actions'][i][field]
|
||||||
for i in range(len(body['actions']))
|
for i in range(len(body['actions']))
|
||||||
if body['actions'][i]['name'] == act_name][0]
|
if body['actions'][i]['name'] == act_name][0]
|
||||||
@ -57,10 +58,10 @@ class ActionTestsV2(base.TestCase):
|
|||||||
self.assertIn('next', body)
|
self.assertIn('next', body)
|
||||||
|
|
||||||
name_1 = body['actions'][0].get('name')
|
name_1 = body['actions'][0].get('name')
|
||||||
next = body.get('next')
|
next_ = body.get('next')
|
||||||
|
|
||||||
param_dict = utils.get_dict_from_string(
|
param_dict = utils.get_dict_from_string(
|
||||||
next.split('?')[1],
|
next_.split('?')[1],
|
||||||
delimiter='&'
|
delimiter='&'
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ class ActionTestsV2(base.TestCase):
|
|||||||
self.assertDictContainsSubset(expected_sub_dict, param_dict)
|
self.assertDictContainsSubset(expected_sub_dict, param_dict)
|
||||||
|
|
||||||
# Query again using 'next' hint
|
# Query again using 'next' hint
|
||||||
url_param = next.split('/')[-1]
|
url_param = next_.split('/')[-1]
|
||||||
resp, body = self.client.get_list_obj(url_param)
|
resp, body = self.client.get_list_obj(url_param)
|
||||||
|
|
||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
|
@ -81,9 +81,9 @@ class ExecutionTestsV2(base.TestCase):
|
|||||||
self.assertIn('next', body)
|
self.assertIn('next', body)
|
||||||
|
|
||||||
workflow_name_1 = body['executions'][0].get('workflow_name')
|
workflow_name_1 = body['executions'][0].get('workflow_name')
|
||||||
next = body.get('next')
|
next_ = body.get('next')
|
||||||
param_dict = utils.get_dict_from_string(
|
param_dict = utils.get_dict_from_string(
|
||||||
next.split('?')[1],
|
next_.split('?')[1],
|
||||||
delimiter='&'
|
delimiter='&'
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class ExecutionTestsV2(base.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Query again using 'next' link
|
# Query again using 'next' link
|
||||||
url_param = next.split('/')[-1]
|
url_param = next_.split('/')[-1]
|
||||||
resp, body = self.client.get_list_obj(url_param)
|
resp, body = self.client.get_list_obj(url_param)
|
||||||
|
|
||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
|
@ -129,10 +129,10 @@ class WorkflowTestsV2(base.TestCase):
|
|||||||
self.assertIn('next', body)
|
self.assertIn('next', body)
|
||||||
|
|
||||||
name_1 = body['workflows'][0].get('name')
|
name_1 = body['workflows'][0].get('name')
|
||||||
next = body.get('next')
|
next_ = body.get('next')
|
||||||
|
|
||||||
param_dict = utils.get_dict_from_string(
|
param_dict = utils.get_dict_from_string(
|
||||||
next.split('?')[1],
|
next_.split('?')[1],
|
||||||
delimiter='&'
|
delimiter='&'
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ class WorkflowTestsV2(base.TestCase):
|
|||||||
self.assertDictContainsSubset(expected_sub_dict, param_dict)
|
self.assertDictContainsSubset(expected_sub_dict, param_dict)
|
||||||
|
|
||||||
# Query again using 'next' hint
|
# Query again using 'next' hint
|
||||||
url_param = next.split('/')[-1]
|
url_param = next_.split('/')[-1]
|
||||||
resp, body = self.client.get_list_obj(url_param)
|
resp, body = self.client.get_list_obj(url_param)
|
||||||
|
|
||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
@ -256,13 +256,13 @@ class WorkflowTestsV2(base.TestCase):
|
|||||||
namespace=namespace
|
namespace=namespace
|
||||||
)
|
)
|
||||||
name = body['workflows'][0]['name']
|
name = body['workflows'][0]['name']
|
||||||
id = body['workflows'][0]['id']
|
wf_id = body['workflows'][0]['id']
|
||||||
|
|
||||||
self.assertEqual(201, resp.status)
|
self.assertEqual(201, resp.status)
|
||||||
self.assertEqual(name, body['workflows'][0]['name'])
|
self.assertEqual(name, body['workflows'][0]['name'])
|
||||||
|
|
||||||
resp, body = self.client.get_workflow(
|
resp, body = self.client.get_workflow(
|
||||||
id
|
wf_id
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(namespace, body['namespace'])
|
self.assertEqual(namespace, body['namespace'])
|
||||||
@ -279,12 +279,12 @@ class WorkflowTestsV2(base.TestCase):
|
|||||||
namespace=namespace
|
namespace=namespace
|
||||||
)
|
)
|
||||||
name = body['workflows'][0]['name']
|
name = body['workflows'][0]['name']
|
||||||
id = body['workflows'][0]['id']
|
wf_id = body['workflows'][0]['id']
|
||||||
|
|
||||||
self.assertEqual(201, resp.status)
|
self.assertEqual(201, resp.status)
|
||||||
self.assertEqual(name, body['workflows'][0]['name'])
|
self.assertEqual(name, body['workflows'][0]['name'])
|
||||||
|
|
||||||
resp, body = self.client.get_workflow(id)
|
resp, body = self.client.get_workflow(wf_id)
|
||||||
|
|
||||||
self.assertEqual(namespace, body['namespace'])
|
self.assertEqual(namespace, body['namespace'])
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ class WorkflowTestsV2(base.TestCase):
|
|||||||
'single_wf.yaml'
|
'single_wf.yaml'
|
||||||
)
|
)
|
||||||
|
|
||||||
resp, body = self.client.get_workflow(id)
|
resp, body = self.client.get_workflow(wf_id)
|
||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
|
|
||||||
@decorators.attr(type='sanity')
|
@decorators.attr(type='sanity')
|
||||||
@ -373,8 +373,7 @@ class WorkflowTestsV2(base.TestCase):
|
|||||||
tr_name = 'trigger'
|
tr_name = 'trigger'
|
||||||
resp, body = self.client.create_workflow('wf_v2.yaml')
|
resp, body = self.client.create_workflow('wf_v2.yaml')
|
||||||
name = body['workflows'][0]['name']
|
name = body['workflows'][0]['name']
|
||||||
resp, body = self.client.create_cron_trigger(
|
self.client.create_cron_trigger(tr_name, name, None, '5 * * * *')
|
||||||
tr_name, name, None, '5 * * * *')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
@ -414,12 +413,7 @@ class WorkflowTestsV2(base.TestCase):
|
|||||||
tr_name = 'trigger'
|
tr_name = 'trigger'
|
||||||
_, body = self.client.create_workflow('wf_v2.yaml', scope='public')
|
_, body = self.client.create_workflow('wf_v2.yaml', scope='public')
|
||||||
name = body['workflows'][0]['name']
|
name = body['workflows'][0]['name']
|
||||||
resp, body = self.alt_client.create_cron_trigger(
|
self.alt_client.create_cron_trigger(tr_name, name, None, '5 * * * *')
|
||||||
tr_name,
|
|
||||||
name,
|
|
||||||
None,
|
|
||||||
'5 * * * *'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
exception = self.assertRaises(
|
exception = self.assertRaises(
|
||||||
|
@ -113,7 +113,9 @@ def _extract_target_headers_from_client(client):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _execute_action(client, request, extra_headers={}):
|
def _execute_action(client, request, extra_headers=None):
|
||||||
|
if extra_headers is None:
|
||||||
|
extra_headers = {}
|
||||||
_, result = client.create_action_execution(
|
_, result = client.create_action_execution(
|
||||||
request,
|
request,
|
||||||
extra_headers=extra_headers
|
extra_headers=extra_headers
|
||||||
|
@ -94,7 +94,8 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
|
|||||||
|
|
||||||
return ip
|
return ip
|
||||||
|
|
||||||
def _wait_until_server_up(self, server_ip, timeout=120, delay=2):
|
@staticmethod
|
||||||
|
def _wait_until_server_up(server_ip, timeout=120, delay=2):
|
||||||
seconds_remain = timeout
|
seconds_remain = timeout
|
||||||
|
|
||||||
LOG.info("Waiting server SSH [IP=%s]...", server_ip)
|
LOG.info("Waiting server SSH [IP=%s]...", server_ip)
|
||||||
|
@ -12,4 +12,5 @@ paramiko>=2.0.0 # LGPLv2.1+
|
|||||||
six>=1.10.0 # MIT
|
six>=1.10.0 # MIT
|
||||||
mock>=2.0.0 # BSD
|
mock>=2.0.0 # BSD
|
||||||
tempest>=17.1.0 # Apache-2.0
|
tempest>=17.1.0 # Apache-2.0
|
||||||
|
testtools>=2.2.0 # MIT
|
||||||
python-keystoneclient>=3.8.0 # Apache-2.0
|
python-keystoneclient>=3.8.0 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user