Loading doc/statisticsDocumentationData.py +38 −2 Original line number Diff line number Diff line from generateDocumentationData import create_json_of_robotfile from os.path import dirname from os import walk from json import dump import requests import json if __name__ == "__main__": basedir = dirname(dirname(__file__)) Loading Loading @@ -41,4 +42,39 @@ if __name__ == "__main__": print("Out of "+str(number_of_all_testcases)+" testcases, "+str(number_of_failures)+" of them failed to be correctly parsed") with open("testcases.json", 'w') as fp: dump(obj=testcases, indent=2, fp=fp) No newline at end of file json.dump(obj=testcases, indent=2, fp=fp) # unpack all permutations of testcases that are under the same .robot file permutations = [] for testcase in testcases: permutation_metadata = {} # everything that is at the top level shall be extracted for key, value in testcase.items(): if key != "test_cases": permutation_metadata[key] = value # everything that is a permutation_body inside, shall rise on its own existenz and be joined with its eprmutation_metadata for permutation_body in testcase["test_cases"]: if "permutation_tp_id" in permutation_body: ptpid = permutation_body["permutation_tp_id"] # strip from beginning up to including the last "/" permutation_body["stripped_permutation_tp_id"] = ptpid[ptpid.rindex("/")+1:] # we use the unpacking python operator ** that strips the container dict from both permutations.append({**permutation_metadata, **permutation_body}) else: print("NO PERMUTATION TP ID") exit(1) with open("permutations.json", 'w') as fp: json.dump(obj=permutations, indent=2, fp=fp) # The URL of the REST endpoint of the NoSQL database dburl = 'http://ec2-18-153-159-20.eu-central-1.compute.amazonaws.com:5555/fromrobot' requests.delete(dburl) # Set the appropriate headers for JSON, if required by the endpoint headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', # Include any other headers the API requires } # Make the POST request response = requests.post(dburl, data=json.dumps(permutations), headers=headers) parsegooglesheet/settings.py +2 −2 Original line number Diff line number Diff line Loading @@ -15,14 +15,14 @@ googlesheet = { } fromrobotschema = { 'tp_id': { 'stripped_permutation_tp_id': { 'type': 'string', 'required': True } } fromrobot = { # most global settings can be overridden at resource level 'resource_methods': ['GET', 'POST'], 'resource_methods': ['GET', 'POST', 'DELETE'], 'allow_unknown': True, 'pagination': False, 'schema': googlesheetschema Loading Loading
doc/statisticsDocumentationData.py +38 −2 Original line number Diff line number Diff line from generateDocumentationData import create_json_of_robotfile from os.path import dirname from os import walk from json import dump import requests import json if __name__ == "__main__": basedir = dirname(dirname(__file__)) Loading Loading @@ -41,4 +42,39 @@ if __name__ == "__main__": print("Out of "+str(number_of_all_testcases)+" testcases, "+str(number_of_failures)+" of them failed to be correctly parsed") with open("testcases.json", 'w') as fp: dump(obj=testcases, indent=2, fp=fp) No newline at end of file json.dump(obj=testcases, indent=2, fp=fp) # unpack all permutations of testcases that are under the same .robot file permutations = [] for testcase in testcases: permutation_metadata = {} # everything that is at the top level shall be extracted for key, value in testcase.items(): if key != "test_cases": permutation_metadata[key] = value # everything that is a permutation_body inside, shall rise on its own existenz and be joined with its eprmutation_metadata for permutation_body in testcase["test_cases"]: if "permutation_tp_id" in permutation_body: ptpid = permutation_body["permutation_tp_id"] # strip from beginning up to including the last "/" permutation_body["stripped_permutation_tp_id"] = ptpid[ptpid.rindex("/")+1:] # we use the unpacking python operator ** that strips the container dict from both permutations.append({**permutation_metadata, **permutation_body}) else: print("NO PERMUTATION TP ID") exit(1) with open("permutations.json", 'w') as fp: json.dump(obj=permutations, indent=2, fp=fp) # The URL of the REST endpoint of the NoSQL database dburl = 'http://ec2-18-153-159-20.eu-central-1.compute.amazonaws.com:5555/fromrobot' requests.delete(dburl) # Set the appropriate headers for JSON, if required by the endpoint headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', # Include any other headers the API requires } # Make the POST request response = requests.post(dburl, data=json.dumps(permutations), headers=headers)
parsegooglesheet/settings.py +2 −2 Original line number Diff line number Diff line Loading @@ -15,14 +15,14 @@ googlesheet = { } fromrobotschema = { 'tp_id': { 'stripped_permutation_tp_id': { 'type': 'string', 'required': True } } fromrobot = { # most global settings can be overridden at resource level 'resource_methods': ['GET', 'POST'], 'resource_methods': ['GET', 'POST', 'DELETE'], 'allow_unknown': True, 'pagination': False, 'schema': googlesheetschema Loading