|
|
@ -67,7 +67,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
";;;;;;", |
|
|
|
"#;;;;;;" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, {}, job) |
|
|
|
self.assertEqual(0, len(tdata)) |
|
|
|
cnttest += 1 |
|
|
|
if "malformated" in tests: |
|
|
@ -104,7 +104,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
"option:description;something;;;;;", |
|
|
|
"#;;;;;;" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, {}, job) |
|
|
|
self.assertEqual(1, len(tdata)) |
|
|
|
print(tdata) |
|
|
|
self.assertIn(D.CSV_BLOCK_OPTION, tdata) |
|
|
@ -114,7 +114,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
"step:1;testa;1;1;table:_lofts,action:import;;;;;", |
|
|
|
"#;;;;;;" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, {}, job) |
|
|
|
print(tdata) |
|
|
|
self.assertEqual(1, len(tdata)) |
|
|
|
self.assertIn(B.DATA_NODE_STEPS, tdata) |
|
|
@ -131,7 +131,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
"#;;;;;;" |
|
|
|
] |
|
|
|
tdata = {} |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, {}, job) |
|
|
|
print(tdata) |
|
|
|
self.assertEqual(1, len(tdata)) |
|
|
|
self.assertIn(B.DATA_NODE_STEPS, tdata) |
|
|
@ -144,7 +144,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
"testa:lofts;1;stra;town;12345;usa;4;1;50;house;111;45;8", |
|
|
|
"#;;;;;;" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, B.DATA_NODE_TABLES, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, B.DATA_NODE_TABLES, {}, job) |
|
|
|
print(tdata) |
|
|
|
self.assertEqual(1, len(tdata)) |
|
|
|
self.assertIn(B.DATA_NODE_TABLES, tdata) |
|
|
@ -170,7 +170,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
"testrest:person;1;Brecht;Bert;10.02.98;m", |
|
|
|
"testrest:person,testcrmdb:person;2;Leon;Donna;28.09.42;f" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_DATA, {}, job) |
|
|
|
print(tdata) |
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|
|
|
|
@ -209,7 +209,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
";;;;;;", |
|
|
|
"#;;;;;;" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_KEYS, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_KEYS, {}, job) |
|
|
|
self.assertEqual(0, len(tdata)) |
|
|
|
cnttest += 1 |
|
|
|
if "malformated" in tests: |
|
|
@ -227,11 +227,11 @@ class MyTestCase(unittest.TestCase): |
|
|
|
";berlin;;;;;", |
|
|
|
";cairo;;;;;" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_KEYS, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_KEYS, {}, job) |
|
|
|
print(str(tdata)) |
|
|
|
self.assertEqual(1, len(tdata)) |
|
|
|
self.assertEqual(1, len(tdata["_tables"])) |
|
|
|
self.assertEqual(3, len(tdata["_tables"]["capital"])) |
|
|
|
self.assertEqual(4, len(tdata["_tables"]["capital"])) |
|
|
|
self.assertEqual(3, len(tdata["_tables"]["capital"]["_keys"])) |
|
|
|
cnttest += 4 |
|
|
|
specLines = [ |
|
|
@ -242,13 +242,13 @@ class MyTestCase(unittest.TestCase): |
|
|
|
";greece;;;;;", |
|
|
|
";germany;;;;;" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_KEYS, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_KEYS, {}, job) |
|
|
|
#tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_TREE) |
|
|
|
print(str(tdata)) |
|
|
|
self.assertEqual(1, len(tdata)) |
|
|
|
self.assertIn("capital", tdata["_tables"]) |
|
|
|
self.assertEqual(2, len(tdata["_tables"])) |
|
|
|
self.assertEqual(3, len(tdata["_tables"]["country"])) |
|
|
|
self.assertEqual(4, len(tdata["_tables"]["country"])) |
|
|
|
self.assertEqual(2, len(tdata["_tables"]["country"]["_keys"])) |
|
|
|
cnttest += 4 |
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
@ -272,7 +272,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
";city;b;str;;F:1", |
|
|
|
"#;;;;;;" |
|
|
|
] |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_CONF, job) |
|
|
|
tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_CONF, {}, job) |
|
|
|
print(tdata) |
|
|
|
self.assertEqual(1, len(tdata)) |
|
|
|
self.assertNotIn(B.DATA_NODE_TABLES, tdata) |
|
|
@ -292,7 +292,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
|
return |
|
|
|
job = test.testtools.getJob() |
|
|
|
cm = basic.componentHandling.ComponentManager.getInstance("J") |
|
|
|
cm = basic.componentHandling.ComponentManager.getInstance(job) |
|
|
|
componentName = "testcrmdb" |
|
|
|
confs = utils.config_tool.getConfig(job, "comp", componentName) |
|
|
|
conns = utils.conn_tool.getConnections(job, componentName) |
|
|
@ -303,7 +303,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
"testcrmdb:person;2;Leon;Donna;28.09.42;f", |
|
|
|
"#;;;;;;" |
|
|
|
] |
|
|
|
filename = utils.path_tool.rejoinPath(utils.path_tool.composePath(P.P_TCBASE, comp), "t_person.csv") |
|
|
|
filename = utils.path_tool.rejoinPath(utils.path_tool.composePath(job, P.P_TCBASE, comp), "t_person.csv") |
|
|
|
tdata = t.parseCsv(comp.m, job, filename, fileLines, comp, aliasNode="") |
|
|
|
print(str(tdata)) |
|
|
|
self.assertIn(B.DATA_NODE_TABLES, tdata) |
|
|
@ -323,7 +323,7 @@ class MyTestCase(unittest.TestCase): |
|
|
|
self.assertIn("person", tdata[B.DATA_NODE_TABLES]) |
|
|
|
self.assertEqual(2, len(tdata[B.DATA_NODE_TABLES]["person"][B.DATA_NODE_DATA])) |
|
|
|
cnttest += 3 |
|
|
|
filename = utils.path_tool.rejoinPath(utils.path_tool.composePath(P.P_TCRESULT, comp), "person.csv") |
|
|
|
filename = utils.path_tool.rejoinPath(utils.path_tool.composePath(job, P.P_TCRESULT, comp), "person.csv") |
|
|
|
fileLines = [ |
|
|
|
"_date;27.06.2022", |
|
|
|
"_count;2", |
|
|
@ -339,7 +339,8 @@ class MyTestCase(unittest.TestCase): |
|
|
|
cnttest += 3 |
|
|
|
text = "" |
|
|
|
for k in tdata[B.DATA_NODE_TABLES]: |
|
|
|
text += t.buildCsvData(filename, tdata[B.DATA_NODE_TABLES][k], comp, job) |
|
|
|
print("---------\n"+str(tdata)) |
|
|
|
text += t.buildCsvData(tdata[B.DATA_NODE_TABLES], k, comp, job) |
|
|
|
text += "\n" |
|
|
|
print(text) |
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|