|
@ -11,13 +11,14 @@ import basic.constants as B |
|
|
import test.constants as T |
|
|
import test.constants as T |
|
|
import model.table |
|
|
import model.table |
|
|
import model.entity |
|
|
import model.entity |
|
|
|
|
|
import tools.data_const as D |
|
|
|
|
|
|
|
|
HOME_PATH = test.constants.HOME_PATH |
|
|
HOME_PATH = test.constants.HOME_PATH |
|
|
PYTHON_CMD = "python" |
|
|
PYTHON_CMD = "python" |
|
|
TEST_FUNCTIONS = ["test_10getEntityNames", "test_11getEntities", "test_12getEntity", |
|
|
TEST_FUNCTIONS = ["test_10getEntityNames", "test_11getEntities", "test_12getEntity", |
|
|
# "test_14insertEntity", # "test_13writeEntity", |
|
|
# "test_14insertEntity", # "test_13writeEntity", |
|
|
"test_20getSchema"] |
|
|
"test_20getSchema"] |
|
|
TEST_FUNCTIONS = [] |
|
|
# TEST_FUNCTIONS = [] |
|
|
PROGRAM_NAME = "clean_workspace" |
|
|
PROGRAM_NAME = "clean_workspace" |
|
|
|
|
|
|
|
|
class MyTestCase(unittest.TestCase): |
|
|
class MyTestCase(unittest.TestCase): |
|
@ -41,7 +42,7 @@ class MyTestCase(unittest.TestCase): |
|
|
self.assertEqual(type(entityNames), list) |
|
|
self.assertEqual(type(entityNames), list) |
|
|
|
|
|
|
|
|
#entityNames = project.select_unique_names(job, "", "", "", {}) |
|
|
#entityNames = project.select_unique_names(job, "", "", "", {}) |
|
|
#self.assertEquals(type(entityNames), list) |
|
|
#self.assertEqual(type(entityNames), list) |
|
|
|
|
|
|
|
|
def test_11getEntities(self): |
|
|
def test_11getEntities(self): |
|
|
global mymsg |
|
|
global mymsg |
|
@ -68,20 +69,23 @@ class MyTestCase(unittest.TestCase): |
|
|
job = test.testtools.getJob() |
|
|
job = test.testtools.getJob() |
|
|
table = model.table.Table(job) |
|
|
table = model.table.Table(job) |
|
|
name = "adress" |
|
|
name = "adress" |
|
|
acttable = table.read_entity(job, name) |
|
|
args = {} |
|
|
self.assertEqual(getattr(acttable, model.table.FIELD_NAME), name) |
|
|
args["context"] = "testdata" |
|
|
|
|
|
acttable = table.read_entity(job, name, args=args) |
|
|
|
|
|
self.assertEqual(getattr(acttable, D.FIELD_NAME), name) |
|
|
self.assertRaises(Exception, table.read_entity, job, "xyzxyz") |
|
|
self.assertRaises(Exception, table.read_entity, job, "xyzxyz") |
|
|
# |
|
|
# |
|
|
table = model.table.Table(job) |
|
|
table = model.table.Table(job) |
|
|
|
|
|
args["context"] = B.ATTR_INST_TESTSERVER |
|
|
name = B.SUBJECT_APP |
|
|
name = B.SUBJECT_APP |
|
|
acttable = table.read_entity(job, name, project=B.ATTR_INST_TESTSERVER) |
|
|
acttable = table.read_entity(job, name, args=args) |
|
|
self.assertEqual(getattr(acttable, model.table.FIELD_NAME), name) |
|
|
self.assertEqual(getattr(acttable, D.FIELD_NAME), name) |
|
|
self.assertRaises(Exception, table.read_entity, job, "xyzxyz") |
|
|
self.assertRaises(Exception, table.read_entity, job, "xyzxyz") |
|
|
# |
|
|
# |
|
|
table = model.table.Table(job) |
|
|
table = model.table.Table(job) |
|
|
name = "ap_application" |
|
|
name = "ap_application" |
|
|
acttable = table.read_entity(job, name, project=B.ATTR_INST_TESTSERVER) |
|
|
acttable = table.read_entity(job, name, args=args) |
|
|
self.assertEqual(getattr(acttable, model.table.FIELD_NAME), name) |
|
|
self.assertEqual(getattr(acttable, D.FIELD_NAME), name) |
|
|
self.assertRaises(Exception, table.read_entity, job, "xyzxyz") |
|
|
self.assertRaises(Exception, table.read_entity, job, "xyzxyz") |
|
|
|
|
|
|
|
|
def test_20getSchema(self): |
|
|
def test_20getSchema(self): |
|
@ -94,16 +98,18 @@ class MyTestCase(unittest.TestCase): |
|
|
job = test.testtools.getJob() |
|
|
job = test.testtools.getJob() |
|
|
table = model.table.Table(job) |
|
|
table = model.table.Table(job) |
|
|
entityNames = table.read_unique_names(job, B.ATTR_INST_TESTSERVER, "", "", {}) |
|
|
entityNames = table.read_unique_names(job, B.ATTR_INST_TESTSERVER, "", "", {}) |
|
|
|
|
|
args = {} |
|
|
|
|
|
args["context"] = B.ATTR_INST_TESTSERVER |
|
|
name = "tc_table" |
|
|
name = "tc_table" |
|
|
print(name) |
|
|
print(name) |
|
|
acttable = table.read_entity(job, name, project=B.ATTR_INST_TESTSERVER) |
|
|
acttable = table.read_entity(job, name, args=args) |
|
|
schema = acttable.get_schema(name) |
|
|
schema = acttable.get_schema(name) |
|
|
print(schema) |
|
|
print(schema) |
|
|
self.assertEqual("CREATE TABLE", schema[:12]) |
|
|
self.assertEqual("CREATE TABLE", schema[:12]) |
|
|
self.assertIn(name, schema) |
|
|
self.assertIn(name, schema) |
|
|
for name in entityNames: |
|
|
for name in entityNames: |
|
|
print(name) |
|
|
print(name) |
|
|
acttable = table.read_entity(job, name, project=B.ATTR_INST_TESTSERVER) |
|
|
acttable = table.read_entity(job, name, args=args) |
|
|
schema = acttable.get_schema(name) |
|
|
schema = acttable.get_schema(name) |
|
|
print(schema) |
|
|
print(schema) |
|
|
self.assertEqual("CREATE TABLE", schema[:12]) |
|
|
self.assertEqual("CREATE TABLE", schema[:12]) |
|
|