#!/usr/bin/python # -*- coding: utf-8 -*- # --------------------------------------------------------------------------------------------------------- # Author : Ulrich Carmesin # Source : gitea.ucarmesin.de # --------------------------------------------------------------------------------------------------------- import os import re import basic.program import basic.catalog import utils.config_tool import basic.constants as B import basic.toolHandling import utils.data_const as D import utils.file_tool import utils.path_tool import xml.etree.ElementTree as ET import basic.catalog class FileFcts(): """ this is an abstract class """ def __init__(self): pass def reset_TData(self, job): pass def setComp(self, job, comp=None): self.job = job self.comp = comp def parseText(self, text): """ this function parses the text and translates it to dict :param text: :return: """ def file2dict(self): pass # Funktionen #=== init_testcase === def removeFiles(self): utils.file_tool.removeFiles(self.comp.m, "envpath", "pattern", self.comp.conf["conn"]) def copyFiles(self): fileList = [] srcpath = "" envpath = "" pattern = "" utils.file_tool.copyFiles(self.job, fileList, srcpath, envpath, pattern) def readEnvFiles(self): envpath = "" pattern = "" fileList = utils.file_tool.getFiles(self.comp.m, envpath, pattern, self.comp.conf["conn"]) # === execute_testcase === def create_request(self, tdata, step): mapping = "" schema = "" archivpath = "" filename = step.args["filename"] txt = "" for o in self.comp.conf[B.SUBJECT_ARTS][B.TOPIC_NODE_FILE]: if o["name"] != filename: continue mapping = o["mapping"] schema = o["schema"] archivpath = os.path.join(utils.path_tool.composePattern("{tcresult}/request", self.comp), filename) # ergebnisse/comp/request ) #txt = self.createDict() utils.file_tool.writeFileText(self.comp.m, archivpath, txt) def send_request(self, job, step): archivpath = "" filename = step.args["filename"] technique = step.args["technique"] archivpath = os.path.join(utils.path_tool.composePattern("{tcresult}/request", self.comp), filename) if technique == "cli": for o in self.comp.conf[B.SUBJECT_ARTS][B.TOPIC_NODE_FILE]: if o["name"] != filename: continue envpath = o["envpath"] envpath = utils.path_tool.composePattern(envpath, self.comp) fct = basic.toolHandling.getCliTool(job, self.comp) fct.copy(self.job, archivpath, envpath) elif technique == "api": txt = utils.file_tool.readFileText(archivpath, self.comp.m) fct = basic.toolHandling.getApiTool(job, self.comp) response = fct.send(self.job, self.comp, txt) archivpath = os.path.join(utils.path_tool.composePattern("{tcresult}/response", self.comp), filename) """ get_response: - channel (sync/async) ... implement - archivpath ( ergebnisse/comp/response ) - envpath ( ./log) / envconn ( = in Request empfangen ) === collect_testcase === - envpath - pattern > readfiles """