Browse Source

refactoring: basic-model - comp

refactor
Ulrich 1 year ago
parent
commit
114d5ccd75
  1. 10
      test/test_14table.py
  2. 3
      test/test_20application.py
  3. 3
      test/test_21environment.py
  4. 3
      test/test_22component.py
  5. 9
      tools/file_type.py

10
test/test_14table.py

@ -73,20 +73,20 @@ class MyTestCase(unittest.TestCase):
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)
args["context"] = B.ATTR_INST_TESTSERVER
name = B.SUBJECT_APP
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)
name = "ap_application"
name = "ap_applications"
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")
def test_20getSchema(self):
global mymsg
@ -100,7 +100,7 @@ class MyTestCase(unittest.TestCase):
entityNames = table.read_unique_names(job, B.ATTR_INST_TESTSERVER, "", "", {})
args = {}
args["context"] = B.ATTR_INST_TESTSERVER
name = "tc_table"
name = "tc_tables"
print(name)
acttable = table.read_entity(job, name, args=args)
schema = acttable.get_schema(name)

3
test/test_20application.py

@ -10,6 +10,7 @@ import basic.constants as B
import test.constants as T
import tools.file_tool
import model.application
import tools.data_const as D
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
@ -65,7 +66,7 @@ class MyTestCase(unittest.TestCase):
application = model.application.Application(job)
name = "TESTAPP"
actproject = application.read_entity(job, name)
self.assertEqual(getattr(actproject, model.application.FIELD_NAME), name)
self.assertEqual(getattr(actproject, D.FIELD_NAME), name)
self.assertRaises(Exception, application.read_entity, job, "xyzxyz")
#
#actproject = component.select_entity(job, name)

3
test/test_21environment.py

@ -11,6 +11,7 @@ import test.constants as T
import tools.file_tool
import model.entity
import model.environment
import tools.data_const as D
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
@ -63,7 +64,7 @@ class MyTestCase(unittest.TestCase):
environment = model.environment.Environment(job, "TESTPROJ")
name = "ENV01"
actrelease = environment.read_entity(job, name)
self.assertEqual(getattr(actrelease, model.environment.FIELD_NAME), name)
self.assertEqual(getattr(actrelease, D.FIELD_NAME), name)
self.assertRaises(Exception, environment.read_entity, job, "xyzxyz")
#
#actenvironment = environment.select_entity(job, name)

3
test/test_22component.py

@ -9,6 +9,7 @@ import basic.constants as B
import test.constants as T
import model.component
import model.entity
import tools.data_const as D
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
@ -61,7 +62,7 @@ class MyTestCase(unittest.TestCase):
component = model.component.Component(job)
name = "testprd"
actproject = component.read_entity(job, name)
self.assertEqual(getattr(actproject, model.component.FIELD_NAME), name)
self.assertEqual(getattr(actproject, D.FIELD_NAME), name)
self.assertRaises(Exception, component.read_entity, job, "xyzxyz")
#
#actproject = component.select_entity(job, name)

9
tools/file_type.py

@ -307,9 +307,12 @@ def check_nodes(job, config: dict, checkNodes: dict):
mustNodes = checkNodes[MUST_NODES]
mustntNodes = checkNodes[MUSTNT_NODES]
optionalNodes = checkNodes[OPT_NODES]
a = str(config["_path"]).split(os.path.sep)
b = a[-1].split(".")
path = config["_path"]
if B.DATA_NODE_PATH in config:
a = str(config[B.DATA_NODE_PATH]).split(os.path.sep)
b = a[-1].split(".")
path = config[B.DATA_NODE_PATH]
else:
path = ""
"""
if b[0] in config:
config = config[b[0]]

Loading…
Cancel
Save