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.
 
 
 

116 lines
4.4 KiB

#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------------------------------------
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import unittest
import inspect
import test.testtools
import basic.constants as B
import test.constants as T
import model.release
import model.entity
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
TEST_FUNCTIONS = ["test_10getEntityNames", "test_11getEntities", "test_12getEntity",
"test_13writeEntity" #, "test_14insertEntity"
]
# TEST_FUNCTIONS = ["test_10getEntityNames", "test_12getEntity"]
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()
release = model.release.Release(job)
entityNames = []
entityNames = release.read_unique_names(job, "", "", "", {})
self.assertEquals(type(entityNames), list)
#entityNames = project.select_unique_names(job, "", "", "", {})
#self.assertEquals(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()
release = model.release.Release(job)
entityNames = []
entityNames = release.get_entities(job, storage=model.entity.STORAGE_FILE)
self.assertEqual(type(entityNames), list)
#entityNames = release.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()
release = model.release.Release(job)
name = "V-1.1.0"
actrelease = release.read_entity(job, name)
self.assertEqual(getattr(actrelease, model.release.FIELD_NAME), name)
self.assertRaises(Exception, release.read_entity, job, "xyzxyz")
#
#actrelease = release.select_entity(job, name)
#self.assertEqual(getattr(actrelease, model.release.FIELD_NAME), name)
#self.assertRaises(Exception, release.select_entity, job, ["xyzxyz"])
def test_13writeEntity(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()
def test_14insertEntity(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()
username = "hans_xyz"
release = model.release.Release()
entityNames = collectInnerList(release.get_unique_names(job, storage=model.entity.STORAGE_DB))
#self.assertNotIn(username, entityNames)
release.username = username
release.name = "Hans"
release.famname = "im Glueck"
release.project = "TESTPROJ"
#release.insert_entity(job, username, table="release")
entityNames = collectInnerList(release.get_unique_names(job, storage=model.entity.STORAGE_DB))
self.assertIn(username, entityNames)
actUser = release.select_entity(job, username)
self.assertEquals(getattr(actUser, model.release.FIELD_NAME), username)
actUser.delete_entity(job, username, "release")
entityNames = collectInnerList(release.get_unique_names(job, storage=model.entity.STORAGE_DB))
self.assertNotIn(username, entityNames)
def collectInnerList(inList):
outList = []
for r in inList:
outList += r
return outList
if __name__ == '__main__':
unittest.main()