Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
2.5 KiB

3 years ago
import unittest, os
3 years ago
import utils.file_tool as t
import utils.path_tool
3 years ago
import basic.program
3 years ago
import test.constants
3 years ago
3 years ago
HOME_PATH = test.constants.HOME_PATH
3 years ago
class MyTestCase(unittest.TestCase):
def runTest(self):
self.test_encoding()
self.test_getFiles()
self.test_pathTool()
3 years ago
def test_getFiles(self):
3 years ago
job = basic.program.Job("unit")
3 years ago
args = {"application": "TEST", "application": "ENV01", "modus": "unit", "loglevel": "debug", "tool": "job_tool",
"modus": "unit"}
job.par.setParameterArgs(args)
r = t.getFiles(job.m, job.conf.confs.get("paths").get("program") + "/utils", "file_.*.py", None)
self.assertEqual((len(r) == 1), True)
r = t.getFiles(job.m, job.conf.confs.get("paths").get("program") + "/utils", "file__.*.py", None)
self.assertEqual((len(r) == 0), True)
r = t.getFiles(job.m, job.conf.confs.get("paths").get("program") + "/utils", ".*_tool.py", None)
self.assertEqual((len(r) > 2), True)
r = t.getFilesRec(job.m, job.conf.confs.get("paths").get("program"), ".*?file.*.py")
# print (r)
3 years ago
3 years ago
def test_pathTool(self):
3 years ago
job = basic.program.Job("unit")
3 years ago
args = {"application": "TEST", "application": "ENV01", "modus": "unit", "loglevel": "debug", "tool": "job_tool",
"modus": "unit"}
job.par.setParameterArgs(args)
#self.assertEqual(utils.path_tool.generatePath("program", "komp", "testA", "CONFIG.yml"),
3 years ago
# os.path.join(HOME_PATH, "components","testA","COFIG.yml"))
def test_encoding(self):
job = basic.program.Job("unit")
print("------- test_encoding")
encodings = ['utf-8', 'windows-1250', 'iso-8859-1']
res = utils.file_tool.getFileEncoding(job.m, os.path.join(HOME_PATH,"test","conf","tdata","encoded_iso8859.txt"))
self.assertEqual(res, "iso-8859-1")
res = utils.file_tool.getFileEncoding(job.m, os.path.join(HOME_PATH,"test","conf","tdata","encoded_win1250.txt"))
self.assertEqual(res, "iso-8859-1")
res = utils.file_tool.getFileEncoding(job.m, os.path.join(HOME_PATH,"test","conf","tdata","encoded_utf8.txt"))
self.assertEqual(res, "utf-8")
3 years ago
if __name__ == '__main__':
unittest.main()