def REQ003(self): self.trace('REQ003') argDict = {'env':self.env, 'external':external, 'implantable':implantable} commandString = '-e %s -x %s -i %s' % (argDict['env'].name, argDict['external'], argDict['implantable']) setCommandLine(commandString) resultTestContext = komodors.getTestContext() self.verifyEqual(perseus.availability.getImplantable(), implantable, msg='implantable') self.verifyEqual(perseus.availability.getExternal(), external, msg='external')
def testDefaultSuccess(klass, argDict, requirement, msg=None): klass.trace(requirement) commandString = '-e %s -x %s -i %s' % (argDict['env'].name, argDict['external'], argDict['implantable']) setCommandLine(commandString) resultTestContext = komodors.getTestContext() klass.verifyEqual(resultTestContext['pgsim'], False, msg=msg) klass.verifyEqual(resultTestContext['brwsr'], komodors.BROWSER_DEFAULT, msg=msg) from komodors import logger as komodorslogger klass.verifyEqual(komodorslogger.getEffectiveLevel(), 0, msg=msg) # 0 = NOTSET
def testException(klass, commandLine=None, requirement='default', msg=None): klass.trace(requirement) setCommandLine(commandLine) try: testContext = komodors.getTestContext() klass.verifyFailed(msg=msg) except (komodors.MissingCommandLineParamError, komodors.UnrecognizedCommandLineParamError): klass.verified(msg=msg) except Exception as e: klass.log.exception(msg=msg) klass.verifyFailed(msg=msg)
def testSuccess(klass, argDict, requirement='default', msg=None): klass.trace(requirement) commandString = '-e %s -x %s -i %s' % (argDict['env'].name, argDict['external'], argDict['implantable']) if 'pgsim' in argDict or 'brwsr' in argDict: commandString += ' -p ' if 'pgsim' in argDict: commandString += 'pgsim=%s' % argDict['pgsim'] if 'brwsr' in argDict: commandString += 'brwsr=%s' % argDict['brwsr'] if 'debug' in argDict: commandString += ' '+argDict['debug'] setCommandLine(commandString) resultTestContext = komodors.getTestContext() for arg, val in argDict.iteritems(): if arg == 'debug': #special case: not checking a value from komodors import logger as komodorslogger klass.verifyEqual(komodorslogger.getEffectiveLevel(), 10, msg=msg) # 10 - DEBUG elif val.__class__ in (str, int, long, dict, list): # check builtin types klass.verifyEqual(val, resultTestContext[arg], msg=msg) else: # check KomodoRS objects klass.verifyEqual(type(val), type(resultTestContext[arg]), msg=msg)