Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

94 lines
3.3 KiB

import unittest
import os
import inspect
import shutil
import tools.path_tool
import basic.program
import test.testtools
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"
TEST_FUNCTIONS = ["test_10getEntityNames", "test_12getEntity", "test_11getEntities" # , "test_10getApplications"
]
#TEST_FUNCTIONS = ["test_11getEntities"]
PROGRAM_NAME = "clean_workspace"
class MyTestCase(unittest.TestCase):
mymsg = "--------------------------------------------------------------"
def test_10getEntityNames(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
assert isinstance(job, object)
print(str(model.application.Application))
application = model.application.Application(job)
entityNames = []
entityNames = application.read_unique_names(job, "", "", "", {})
self.assertEqual(type(entityNames), list)
print("apps "+str(entityNames))
#entityNames = component.select_unique_names(job, "", "", "", {})
#self.assertEqual(type(entityNames), list)
def test_11getEntities(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
application = model.application.Application(job) #.application.Application(job)
entityNames = application.get_entities(job, storage=model.entity.STORAGE_FILE)
self.assertEqual(type(entityNames), list)
#entityNames = environment.get_entities(job, storage=model.entity.STORAGE_DB)
#self.assertEqual(type(entityNames), list)
def test_12getEntity(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
application = model.application.Application(job)
name = "TESTAPP"
actproject = application.read_entity(job, name)
self.assertEqual(getattr(actproject, D.FIELD_NAME), name)
self.assertRaises(Exception, application.read_entity, job, "xyzxyz")
#
#actproject = component.select_entity(job, name)
#self.assertEqual(getattr(actproject, model.component.FIELD_USERNAME), name)
#self.assertRaises(Exception, component.select_entity, job, ["xyzxyz"])
def test_xx10getApplications(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
# simple job instantiate - without parameter and only simple messaging
job = test.testtools.getJob()
print(str(job.__dict__))
jobObject = job
projList = ["TESTPROJ"]
apps = model.application.select_applications(job, projList)
print(str(apps))
if __name__ == '__main__':
unittest.main()