Skip to content

Commit

Permalink
Changing inputs as a optional parameter in job-invocation (#866) (#872)
Browse files Browse the repository at this point in the history
* Changing inputs as a optional parameter in job-invocation

* Update nailgun/entities.py

Co-authored-by: Gaurav Talreja <gauravtalreja1@gmail.com>

Co-authored-by: Gaurav Talreja <gauravtalreja1@gmail.com>
(cherry picked from commit 51273ae)

Co-authored-by: Adarsh dubey <addubey@redhat.com>
  • Loading branch information
Satellite-QE and adarshdubey-star authored Jan 9, 2023
1 parent 565917f commit f82a44b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,8 +1656,8 @@ def run(self, synchronous=True, **kwargs):
job_template_id/feature,
targeting_type,
search_query/bookmark_id,
inputs
optional:
inputs,
description_format,
concurrency_control
scheduling,
Expand All @@ -1675,9 +1675,8 @@ def run(self, synchronous=True, **kwargs):
raise KeyError('Provide either job_template_id or feature value')
if 'search_query' not in kwargs['data'] and 'bookmark_id' not in kwargs['data']:
raise KeyError('Provide either search_query or bookmark_id value')
for param_name in ['targeting_type', 'inputs']:
if param_name not in kwargs['data']:
raise KeyError(f'Provide {param_name} value')
if 'targeting_type' not in kwargs['data']:
raise KeyError('Provide targeting_type value')
kwargs['data'] = {'job_invocation': kwargs['data']}
response = client.post(self.path('base'), **kwargs)
response.raise_for_status()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3798,7 +3798,7 @@ def test_required_param(self):
{'feature': 'foo', 'inputs': 'ls'},
{'job_template_id': 1, 'search_query': 'foo'},
{'feature': 'foo', 'bookmark_id': 1, 'inputs': 'ls'},
{'feature': 'foo', 'bookmark_id': 1, 'targeting_type': 'foo'},
{'feature': 'foo', 'job_template_id': 1, 'targeting_type': 'foo'},
]
for data in data_list:
with self.assertRaises(KeyError):
Expand Down

0 comments on commit f82a44b

Please sign in to comment.