import json from graphql_gateway import GraphQlGateway class InputFormatter: def __init__(self, app): self.app = app self.query_path = "qa_testing_utils/graphQlQueryGenerator/queries/" def get_application_queries(self): f = open(f"{self.query_path}/application-operations.json") operations_by_app = json.load(f) return operations_by_app[self.app] def get_operation_variable_list(self, op): f = open(f'{self.query_path}/{self.app}-variables.json') list_by_operation = json.load(f) return list_by_operation[op] @staticmethod def add_profile_uuid(var_set, application): graph_ql_gateway = GraphQlGateway(application) query_path = 'qa_testing_utils/graphQlQueryGenerator/queries/custom/getProfileUuid.txt' response = graph_ql_gateway.manual_query(var_set, query_path, {"identityId": var_set["variables"]["identityId"]}) for profile in response["identityById"]["profiles"]: if profile["profileType"] == application.upper(): var_set["variables"]["profileUUID"] = profile["profileUUID"] return var_set