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.
 
 
 

87 lines
3.7 KiB

"""
unit-test
"""
import unittest
import utils.css_tool
import basic.program
import test.testtools
import basic.constants as B
# the list of TEST_FUNCTIONS defines which function will be really tested.
# if you minimize the list you can check the specific test-function
TEST_FUNCTIONS = ["test_01css"]
#TEST_FUNCTIONS = ["test_01css"]
# with this variable you can switch prints on and off
verbose = False
class MyTestCase(unittest.TestCase):
def runTest(self):
self.test_css()
def test_01css(self):
job = test.testtools.getJob()
args = {"application": "TEST", "environment": "ENV01", "modus": "unit", "loglevel": "debug",
"tool": "job_tool", "tdtyp": "csv", "tdsrc": "implement", "tdname": "firstunit",
"modus": "unit"}
job.par.setParameterArgs(job, args)
# ------- inline ---------------
job.conf.setConfig("tool.css.type", "inline")
job.conf.confs.get(B.SUBJECT_TOOL).get("css").get("typ") == "inline"
text = utils.css_tool.getInlineStyle(job, "diffFiles", "diffA")
self.assertEqual(len(text), 37)
self.assertEqual(("style" in text), True)
text = utils.css_tool.getInlineStyle(job, "diffFiles", "acceptA")
self.assertEqual(len(text), 23)
self.assertEqual(("style" in text), True)
text = utils.css_tool.getInlineStyle(job, "resultFile", "result1")
self.assertEqual(len(text), 36)
self.assertEqual(("style" in text), True)
text = utils.css_tool.getInternalStyle(job, "diffFiles")
self.assertEqual(len(text), 84)
text = utils.css_tool.getExternalStyle(job, "diffFiles")
self.assertEqual(len(text), 0)
# ------- internal ---------------
job.conf.setConfig("tool.css.type", "internal")
text = utils.css_tool.getInlineStyle(job, "diffFiles", "diffA")
self.assertEqual(len(text), 13)
self.assertEqual(("class" in text), True)
text = utils.css_tool.getInlineStyle(job, "resultFile", "result1")
self.assertEqual(len(text), 15)
self.assertEqual(("class" in text), True)
text = utils.css_tool.getInternalStyle(job, "diffFiles")
if verbose: print(text)
self.assertEqual(len(text), 262)
self.assertEqual(("<style>" in text), True)
text = utils.css_tool.getInternalStyle(job, "resultFile")
if verbose: print(text)
self.assertEqual(len(text), 283)
self.assertEqual(("<style>" in text), True)
text = utils.css_tool.getInternalStyle(job, "diffFiles,resultFile")
if verbose: print(text)
self.assertEqual(len(text), 465)
self.assertEqual(("<style>" in text), True)
text = utils.css_tool.getExternalStyle(job, "diffFiles")
self.assertEqual(len(text), 0)
if verbose: print(text)
if verbose: print(str(len(text)))
# ------- external ---------------
job.conf.setConfig("tool.css.type", "external")
text = utils.css_tool.getInlineStyle(job, "diffFiles", "diffA")
self.assertEqual(len(text), 13)
self.assertEqual(("class" in text), True)
text = utils.css_tool.getInternalStyle(job, "diffFiles")
if verbose: print(text)
self.assertEqual(len(text), 55)
self.assertEqual(("<link " in text and "stylesheet" in text), True)
text = utils.css_tool.getExternalStyle(job, "diffFiles")
self.assertEqual(len(text), 216)
if verbose: print(text)
if verbose: print(str(len(text)))
text = utils.css_tool.getExternalStyle(job, "diffFiles,resultFile")
self.assertEqual(len(text), 449)
if verbose: print(text)
if verbose: print(str(len(text)))
if __name__ == '__main__':
verbose = True
unittest.main()