def cli(name_or_id, scenario, detached, name, description, as_code, web_vu, sap_vu, citrix_vu, return_0): """run a test""" if not name_or_id or name_or_id == "cur": name_or_id = user_data.get_meta(test_settings.meta_key) is_id = tools.is_id(name_or_id) test_settings_json = tools.get_named_or_id(name_or_id, is_id, test_settings.__resolver) _id = test_settings_json['id'] if scenario: rest_crud.patch('v2/test_result/' + _id, {'scenarioName': scenario}) naming_pattern = name if name else test_settings_json[ 'testResultNamingPattern'] if not naming_pattern: naming_pattern = "#${runID}" naming_pattern = naming_pattern.replace( '${runID}', str(test_settings_json['nextRunId'])) # Sorry for that, post data are in the query string :'( :'( post_result = rest_crud.post( 'v2/tests/%s/start?%s' % (_id, create_data(naming_pattern, description, as_code, web_vu, sap_vu, citrix_vu)), {}) user_data.set_meta(test_settings.meta_key, _id) user_data.set_meta(test_results.meta_key, post_result['resultId']) if not detached: running_tools.wait(post_result['resultId'], not return_0) else: tools.print_json(post_result)
def cli(name_or_id, scenario, detached, name, description, as_code, web_vu, sap_vu, citrix_vu, return_0): """run a test""" rest_crud.set_current_command() if not name_or_id or name_or_id == "cur": name_or_id = user_data.get_meta(test_settings.meta_key) is_id = tools.is_id(name_or_id) test_settings_json = tools.get_named_or_id(name_or_id, is_id, test_settings.__resolver) _id = test_settings_json['id'] if scenario: rest_crud.patch(test_settings.get_end_point(_id), {'scenarioName': scenario}) naming_pattern = name if name else test_settings_json[ 'testResultNamingPattern'] if not naming_pattern: naming_pattern = "#${runID}" naming_pattern = naming_pattern.replace( '${runID}', str(test_settings_json['nextRunId'])) hooks.trig("test.start", test_settings_json) # Sorry for that, post data are in the query string :'( :'( post_result = rest_crud.post( test_settings.get_end_point(_id) + '/start?' + create_data( naming_pattern, description, as_code, web_vu, sap_vu, citrix_vu), {}) user_data.set_meta(test_settings.meta_key, _id) user_data.set_meta(test_results.meta_key, post_result['resultId']) # Wait 5 seconds until the test result is created. time.sleep(5) if not detached: running_tools.wait(post_result['resultId'], not return_0) else: tools.print_json(post_result)
def patch(__id, json_data): rep = rest_crud.patch(get_end_point(__id), json_data) tools.get_id_and_print_json(rep)
def patch(id_settings, json_data): rep = rest_crud.patch(get_end_point(id_settings), fill_default_fields(json_data)) tools.get_id_and_print_json(rep)
def patch(id_settings, json_data): rep = rest_crud.patch(get_end_point(id_settings), json_data) tools.get_id_and_print_json(rep)