""" 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(("