|
@ -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)) |
|
|
self.assertEqual(0, len(tdata)) |
|
|
cnttest += 1 |
|
|
cnttest += 1 |
|
|
if "malformated" in tests: |
|
|
if "malformated" in tests: |
|
@ -104,7 +104,7 @@ class MyTestCase(unittest.TestCase): |
|
|
"option:description;something;;;;;", |
|
|
"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)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
print(tdata) |
|
|
print(tdata) |
|
|
self.assertIn(D.CSV_BLOCK_OPTION, 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;;;;;", |
|
|
"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) |
|
|
print(tdata) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertIn(B.DATA_NODE_STEPS, tdata) |
|
|
self.assertIn(B.DATA_NODE_STEPS, tdata) |
|
@ -131,7 +131,7 @@ class MyTestCase(unittest.TestCase): |
|
|
"#;;;;;;" |
|
|
"#;;;;;;" |
|
|
] |
|
|
] |
|
|
tdata = {} |
|
|
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) |
|
|
print(tdata) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertIn(B.DATA_NODE_STEPS, 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", |
|
|
"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) |
|
|
print(tdata) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertIn(B.DATA_NODE_TABLES, 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;1;Brecht;Bert;10.02.98;m", |
|
|
"testrest:person,testcrmdb:person;2;Leon;Donna;28.09.42;f" |
|
|
"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) |
|
|
print(tdata) |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
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)) |
|
|
self.assertEqual(0, len(tdata)) |
|
|
cnttest += 1 |
|
|
cnttest += 1 |
|
|
if "malformated" in tests: |
|
|
if "malformated" in tests: |
|
@ -227,11 +227,11 @@ class MyTestCase(unittest.TestCase): |
|
|
";berlin;;;;;", |
|
|
";berlin;;;;;", |
|
|
";cairo;;;;;" |
|
|
";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)) |
|
|
print(str(tdata)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertEqual(1, len(tdata["_tables"])) |
|
|
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"])) |
|
|
self.assertEqual(3, len(tdata["_tables"]["capital"]["_keys"])) |
|
|
cnttest += 4 |
|
|
cnttest += 4 |
|
|
specLines = [ |
|
|
specLines = [ |
|
@ -242,13 +242,13 @@ class MyTestCase(unittest.TestCase): |
|
|
";greece;;;;;", |
|
|
";greece;;;;;", |
|
|
";germany;;;;;" |
|
|
";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) |
|
|
#tdata = t.parseCsvSpec(job.m, specLines, D.CSV_SPECTYPE_TREE) |
|
|
print(str(tdata)) |
|
|
print(str(tdata)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertIn("capital", tdata["_tables"]) |
|
|
self.assertIn("capital", tdata["_tables"]) |
|
|
self.assertEqual(2, len(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"])) |
|
|
self.assertEqual(2, len(tdata["_tables"]["country"]["_keys"])) |
|
|
cnttest += 4 |
|
|
cnttest += 4 |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
@ -272,7 +272,7 @@ class MyTestCase(unittest.TestCase): |
|
|
";city;b;str;;F:1", |
|
|
";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) |
|
|
print(tdata) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertEqual(1, len(tdata)) |
|
|
self.assertNotIn(B.DATA_NODE_TABLES, tdata) |
|
|
self.assertNotIn(B.DATA_NODE_TABLES, tdata) |
|
@ -292,7 +292,7 @@ class MyTestCase(unittest.TestCase): |
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
return |
|
|
return |
|
|
job = test.testtools.getJob() |
|
|
job = test.testtools.getJob() |
|
|
cm = basic.componentHandling.ComponentManager.getInstance("J") |
|
|
cm = basic.componentHandling.ComponentManager.getInstance(job) |
|
|
componentName = "testcrmdb" |
|
|
componentName = "testcrmdb" |
|
|
confs = utils.config_tool.getConfig(job, "comp", componentName) |
|
|
confs = utils.config_tool.getConfig(job, "comp", componentName) |
|
|
conns = utils.conn_tool.getConnections(job, 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", |
|
|
"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="") |
|
|
tdata = t.parseCsv(comp.m, job, filename, fileLines, comp, aliasNode="") |
|
|
print(str(tdata)) |
|
|
print(str(tdata)) |
|
|
self.assertIn(B.DATA_NODE_TABLES, 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.assertIn("person", tdata[B.DATA_NODE_TABLES]) |
|
|
self.assertEqual(2, len(tdata[B.DATA_NODE_TABLES]["person"][B.DATA_NODE_DATA])) |
|
|
self.assertEqual(2, len(tdata[B.DATA_NODE_TABLES]["person"][B.DATA_NODE_DATA])) |
|
|
cnttest += 3 |
|
|
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 = [ |
|
|
fileLines = [ |
|
|
"_date;27.06.2022", |
|
|
"_date;27.06.2022", |
|
|
"_count;2", |
|
|
"_count;2", |
|
@ -339,7 +339,8 @@ class MyTestCase(unittest.TestCase): |
|
|
cnttest += 3 |
|
|
cnttest += 3 |
|
|
text = "" |
|
|
text = "" |
|
|
for k in tdata[B.DATA_NODE_TABLES]: |
|
|
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" |
|
|
text += "\n" |
|
|
print(text) |
|
|
print(text) |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|