|
@ -12,6 +12,7 @@ import test.constants as T |
|
|
import model.testcase |
|
|
import model.testcase |
|
|
import model.entity |
|
|
import model.entity |
|
|
import tools.data_tool |
|
|
import tools.data_tool |
|
|
|
|
|
import tools.data_const as D |
|
|
|
|
|
|
|
|
HOME_PATH = test.constants.HOME_PATH |
|
|
HOME_PATH = test.constants.HOME_PATH |
|
|
PYTHON_CMD = "python" |
|
|
PYTHON_CMD = "python" |
|
@ -33,30 +34,26 @@ class MyTestCase(unittest.TestCase): |
|
|
job = test.testtools.getJob() |
|
|
job = test.testtools.getJob() |
|
|
tcname = "TC0001" |
|
|
tcname = "TC0001" |
|
|
tcproject = "TESTPROJ" |
|
|
tcproject = "TESTPROJ" |
|
|
testcase = model.testcase.Testcase(job, tcproject) |
|
|
testcase = model.testcase.Testcase(job, tcname) |
|
|
# eigene Attribute vollstaendig |
|
|
# eigene Attribute vollstaendig |
|
|
testcase = model.testcase.Testcase(job, tcproject) |
|
|
testcase = model.testcase.Testcase(job, tcname) |
|
|
|
|
|
|
|
|
args = {} |
|
|
args = {} |
|
|
args[tcname] = {} |
|
|
args[tcname] = {} |
|
|
for k in model.testcase.LIST_FIELDS: |
|
|
for k in model.testcase.Testcase.LIST_FIELDS: |
|
|
args[tcname][k] = "ATTR_" + k |
|
|
args[tcname][k] = "ATTR_" + k |
|
|
testcase = testcase.setAttributes(job, args, tcname, |
|
|
testcase = testcase.setAttributes(job, args, tcname, |
|
|
model.testcase.LIST_FIELDS, |
|
|
model.testcase.Testcase.LIST_FIELDS, |
|
|
model.testcase.LIST_NODES, |
|
|
model.testcase.Testcase.LIST_NODES, |
|
|
model.testcase.LIST_SUBTABLES) |
|
|
model.testcase.Testcase.LIST_SUBTABLES) |
|
|
for k in model.testcase.LIST_FIELDS: |
|
|
for k in model.testcase.Testcase.LIST_FIELDS: |
|
|
if k == model.testcase.FIELD_NAME: |
|
|
if k == D.FIELD_NAME: |
|
|
self.assertEqual(tcname, getattr(testcase, k)) |
|
|
self.assertEqual(tcname, getattr(testcase, k)) |
|
|
elif k == model.testcase.FIELD_PROJECT: |
|
|
|
|
|
self.assertEqual(tcproject, getattr(testcase, k)) |
|
|
|
|
|
else: |
|
|
|
|
|
self.assertEqual(getattr(testcase, k), "ATTR_" + k) |
|
|
|
|
|
for k in LIST_XARGS: |
|
|
for k in LIST_XARGS: |
|
|
self.assertEqual(hasattr(testcase, k), False) |
|
|
self.assertEqual(hasattr(testcase, k), False) |
|
|
self.assertEqual(hasattr(testcase, tools.data_tool.getPluralKeyword(B.DATA_NODE_TOPICS)), False) |
|
|
self.assertEqual(hasattr(testcase, tools.data_tool.getPluralKeyword(B.DATA_NODE_TOPICS)), False) |
|
|
# andere Attribute vollstaendig |
|
|
# andere Attribute vollstaendig |
|
|
testcase = model.testcase.Testcase(job, tcproject) |
|
|
testcase = model.testcase.Testcase(job, tcname) |
|
|
args = {} |
|
|
args = {} |
|
|
args[tcname] = {} |
|
|
args[tcname] = {} |
|
|
attr = {} |
|
|
attr = {} |
|
@ -70,19 +67,15 @@ class MyTestCase(unittest.TestCase): |
|
|
topics[k]["type"] = "x-type" |
|
|
topics[k]["type"] = "x-type" |
|
|
args[tcname][tools.data_tool.getPluralKeyword(B.DATA_NODE_TOPICS)] = topics |
|
|
args[tcname][tools.data_tool.getPluralKeyword(B.DATA_NODE_TOPICS)] = topics |
|
|
testcase = testcase.setAttributes(job, args, tcname, |
|
|
testcase = testcase.setAttributes(job, args, tcname, |
|
|
model.testcase.LIST_FIELDS, |
|
|
model.testcase.Testcase.LIST_FIELDS, |
|
|
model.testcase.LIST_NODES, |
|
|
model.testcase.Testcase.LIST_NODES, |
|
|
model.testcase.LIST_SUBTABLES) |
|
|
model.testcase.Testcase.LIST_SUBTABLES) |
|
|
for k in model.testcase.LIST_FIELDS: |
|
|
for k in model.testcase.Testcase.LIST_FIELDS: |
|
|
if k == model.testcase.FIELD_NAME: |
|
|
if k == D.FIELD_NAME: |
|
|
self.assertEqual(tcname, getattr(testcase, k)) |
|
|
self.assertEqual(tcname, getattr(testcase, k)) |
|
|
elif k == model.testcase.FIELD_PROJECT: |
|
|
|
|
|
self.assertEqual(tcproject, getattr(testcase, k)) |
|
|
|
|
|
else: |
|
|
|
|
|
self.assertEqual("", getattr(testcase, k, "")) |
|
|
|
|
|
for k in LIST_XARGS: |
|
|
for k in LIST_XARGS: |
|
|
self.assertEqual(hasattr(testcase, k), False) |
|
|
self.assertEqual(hasattr(testcase, k), False) |
|
|
for k in model.testcase.LIST_NODES: |
|
|
for k in model.testcase.Testcase.LIST_NODES: |
|
|
print(k) |
|
|
print(k) |
|
|
self.assertEqual(hasattr(testcase, k), True) |
|
|
self.assertEqual(hasattr(testcase, k), True) |
|
|
self.assertEqual(hasattr(testcase, tools.data_tool.getPluralKeyword(B.DATA_NODE_TOPICS)), True) |
|
|
self.assertEqual(hasattr(testcase, tools.data_tool.getPluralKeyword(B.DATA_NODE_TOPICS)), True) |
|
@ -98,7 +91,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() |
|
|
testcase = model.testcase.Testcase(job, "TESTPROJ") |
|
|
testcase = model.testcase.Testcase(job) |
|
|
entityNames = [] |
|
|
entityNames = [] |
|
|
entityNames = testcase.get_entities(job, storage=model.entity.STORAGE_FILE) |
|
|
entityNames = testcase.get_entities(job, storage=model.entity.STORAGE_FILE) |
|
|
self.assertEqual(type(entityNames), list) |
|
|
self.assertEqual(type(entityNames), list) |
|
@ -113,10 +106,10 @@ 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() |
|
|
testcase = model.testcase.Testcase(job, "TESTPROJ") |
|
|
testcase = model.testcase.Testcase(job) |
|
|
name = "TC0001" |
|
|
name = "TC0001" |
|
|
acttestcase = testcase.read_entity(job, name) |
|
|
acttestcase = testcase.read_entity(job, name) |
|
|
self.assertEqual(getattr(acttestcase, model.testcase.FIELD_NAME), name) |
|
|
self.assertEqual(getattr(acttestcase, D.FIELD_NAME), name) |
|
|
self.assertRaises(Exception, testcase.read_entity, job, "xyzxyz") |
|
|
self.assertRaises(Exception, testcase.read_entity, job, "xyzxyz") |
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|