def test_PGModelIsNotSpecifiedRaisesError(self): """ Verifies requirement GEN000003. Checks that the missing config exception is thrown when the PG model is not specified. """ # Setup Mock Object self.common.SetupMox(self) testharness.getOptDebugFlag().AndReturn(True) testharness.getOptParam().AndReturn(None) testharness.getOptExternal().AndReturn(self.external) testharness.getOptImplantable().AndReturn(None) testharness.getOptEnv().AndReturn(self.env) self.mocker.ReplayAll() self.trace('GEN000003') try: tc = komodo.getTestContext() self.verifyFailed(msg="Did not catch the MissingCommandLineParamError exception.") except komodo.MissingCommandLineParamError: self.verified(msg="MissingCommandLineParamError was raised") except: self.verifyFailed(msg="Did not catch the MissingCommandLineParamError exception.") self.mocker.VerifyAll() # Reset Mock Object self.common.UnsetMox(self)
def test_EnvironmentNameIsNotSpecifiedRaisesError(self): """ Verifies requirement GEN000003. Checks that the environment name must be specified in the command line parameters. """ # Setup Mock Object self.common.SetupMox(self) testharness.getOptDebugFlag().AndReturn(True) testharness.getOptParam().AndReturn(None) testharness.getOptExternal().AndReturn(self.external) testharness.getOptImplantable().AndReturn(self.implantable) testharness.getOptEnv().AndReturn(None) self.mocker.ReplayAll() self.trace('GEN000003') try: tc = komodo.getTestContext() self.verifyFailed(msg="Did not catch the MissingCommandLineParamError exception.") except komodo.MissingCommandLineParamError: self.verified(msg="MissingCommandLineParamError was raised") except: self.verifyFailed(msg="Did not catch the MissingCommandLineParamError exception.") self.mocker.VerifyAll() # Reset Mock Object self.common.UnsetMox(self)
def test_MalformedPGSimParameter(self): """ Verifies requirement GEN000003. Check that bad inputs are handled correctly. """ # Setup Mock Object self.common.SetupMox(self) testharness.getOptDebugFlag().AndReturn(True) testharness.getOptParam().AndReturn({'pgsim': self.badBooleanName}) testharness.getOptExternal().AndReturn(self.external) testharness.getOptImplantable().AndReturn(self.implantable) testharness.getOptEnv().AndReturn(self.env) self.mocker.ReplayAll() self.trace('GEN000003') try: tc = komodo.getTestContext() self.verifyFailed(msg="Did not catch the UnrecognizedCommandLineParamError exception.") except komodo.UnrecognizedCommandLineParamError: self.verified(msg="UnrecognizedCommandLineParamError was raised") except: self.verifyFailed(msg="Did not catch the UnrecognizedCommandLineParamError exception.") self.mocker.VerifyAll() # Reset Mock Object self.common.UnsetMox(self)
def setUp(self): self.testContext = komodo.getTestContext() self.enroll = komodo.enrollment.getInstance(self.testContext) self.dwi = komodo.dragonweb.getInstance(self.testContext, throwExceptions=True) self.shortcutInstance = komodo.shortcuts.Shortcuts(self.testContext) self.clinic1 = self.enroll.createClinic("DW_Patient_Search") self.subclinic1 = self.enroll.createSubclinic(clinicObj=self.clinic1) self.subclinic2 = self.enroll.createSubclinic(clinicObj=self.clinic1) self.clinician1 = self.enroll.createClinician(clinicObj=self.clinic1,role=CAM) self.pg = self.enroll.createPG(self.clinic1) self.comm = self.enroll.createCommunicator(self.clinic1) self.patient1 = self.enroll.createPatient(subclinicObj = self.subclinic1,pgObj=self.pg, commObj=self.comm,searchTag="Brady", healthSubclinicObj = self.subclinic2) self.comm1,self.pg1= self.shortcutInstance.initializeHardware(self.patient1,True,True) #self.pg1.createAlert('TherapyHistoryCorruption') #self.pg1.createAlert('RV_LeadImpedanceHigh') self.shortcutInstance.createAlert(pg=self.pg1,alertType='Red') self.shortcutInstance.createAlert(pg=self.pg1,alertType='Yellow') self.comm1.performPII() self.pg1.close()
def test_EnvironmentObjectIsRetrieved(self): """ Verifies requirement GEN000003. Checks that the environment object was retrieved. """ # Setup Mock Object self.common.SetupMox(self) # Stub out the testharness functions that are called testharness.getOptDebugFlag().AndReturn(True) testharness.getOptParam().AndReturn(None) testharness.getOptExternal().AndReturn(self.external) testharness.getOptImplantable().AndReturn(self.implantable) testharness.getOptEnv().AndReturn(self.env) # In order for the testContext to return successfully, the environment # geography and the external availability should match. Force this to # occur with a mock environment object MockEnv = mox.MockObject(Environment) MockEnv.geography = 'us' availability.evaluate('US').AndReturn(True) environment.getInstance(self.env).AndReturn(MockEnv) self.mocker.ReplayAll() testContext = komodo.getTestContext() # Verification self.trace('GEN000003') self.verify(testContext['env'] is not None) self.mocker.VerifyAll() # Reset Mock Object self.common.UnsetMox(self)
def setUp(self): """ Nominal values """ self.env = "isosys5c" self.implantable = "K062-100-1" self.external = "US_1.0_JAGNA" self.badBrowserName = "NotABrowser" self.badBooleanName = "Tru" self.common = Common() # This is only for reporting purposes in the log tc = komodo.getTestContext()
def setUp(self): self.testContext = komodo.getTestContext() self.enroll = komodo.enrollment.getInstance(self.testContext) self.dwi = komodo.dragonweb.getInstance(self.testContext, throwExceptions=True) self.shortcutInstance = komodo.shortcuts.Shortcuts(self.testContext) self.clinic1 = self.enroll.createClinic("DW_Enroll_Patient") self.subclinic1 = self.enroll.createSubclinic(clinicObj=self.clinic1) self.clinician1 = self.enroll.createClinician(clinicObj=self.clinic1,role=CAM) self.patientList = [] self.patient1 = self.enroll.createPatient(subclinicObj=self.subclinic1,pgObj=self.enroll.createPG(self.clinic1), commObj=self.enroll.createCommunicator(self.clinic1)) self.comm1,self.pg1= self.shortcutInstance.initializeHardware(self.patient1,True,True) #self.pg1.createAlert('TherapyHistoryCorruption') self.shortcutInstance.createAlert(pg=self.pg1,alertType='Red') self.shortcutInstance.createAlert(pg=self.pg1,alertType='Yellow') self.pg1.createAlert('LimitedTelemetryInductiveOnly') self.comm1.performPII()
def test_ParameterDefaultsAreSetCorrectly(self): """ Verifies requirements GEN000003 and GEN000004. Check that the default optional parameters are set when none are specified. GEN000003: Komodo shall provide a context to capture command line options for the following attributes: External, Implantable, Environment, Browser Type, Enroll type, PG Simulator, Debug. GEN000004: Komodo shall provide the ability to load the product line model for the external and implantable in the context. """ # Setup Mock Object self.common.SetupMox(self) testharness.getOptDebugFlag().AndReturn(True) testharness.getOptParam().AndReturn(None) testharness.getOptExternal().AndReturn(self.external) testharness.getOptImplantable().AndReturn(self.implantable) testharness.getOptEnv().AndReturn(self.env) # In order for the testContext to return successfully, the environment # geography and the external availability should match. Force this to # occur with a mock environment object MockEnv = mox.MockObject(Environment) MockEnv.geography = 'us' availability.evaluate('US').AndReturn(True) environment.getInstance(self.env).AndReturn(MockEnv) self.mocker.ReplayAll() testContext = komodo.getTestContext() self.trace('GEN000003') self.verifyEqual(testContext['brwsr'], komodo.BROWSER_DEFAULT) self.verifyEqual(testContext['pgsim'], False) self.verifyEqual(testContext['enroll'], True) self.mocker.VerifyAll() # Reset Mock Object self.common.UnsetMox(self) self.trace('GEN000004') self.verifyTrue(availability.getExternal() is not None, msg="External PLM was loaded.") self.verifyTrue(availability.getImplantable() is not None, msg="Implantable PLM was loaded.")
def test_EnvironmentExternalGeographyMismatchRaisesError(self): """ Verifies requirement GEN000005. Check that the external param and the env geography mismatch throw an error. """ # Setup Mock Object self.common.SetupMox(self) testharness.getOptDebugFlag().AndReturn(True) testharness.getOptParam().AndReturn(None) testharness.getOptExternal().AndReturn(self.external) testharness.getOptImplantable().AndReturn(self.implantable) testharness.getOptEnv().AndReturn(self.env) # In order for the testContext to return successfully, the environment # geography and the external availability should match. Force this to # occur with a mock environment object MockEnv = mox.MockObject(Environment) MockEnv.geography = 'us' availability.evaluate('US').AndReturn(False) environment.getInstance(self.env).AndReturn(MockEnv) self.mocker.ReplayAll() self.trace('GEN000005') try: tc = komodo.getTestContext() self.verifyFailed(msg="Did not catch the ExternalPLMEnvironmentMismatchError exception.") except ExternalPLMEnvironmentMismatchError: self.verified(msg="ExternalPLMEnvironmentMismatchError was raised") except: self.verifyFailed(msg="Did not catch the ExternalPLMEnvironmentMismatchError exception.") self.mocker.VerifyAll() # Reset Mock Object self.common.UnsetMox(self)
def setup(klass): klass.log = perseus.log.getLogger('EnrollmentTest:') klass.testContext = komodo.getTestContext() klass.shortcuts = Shortcuts(klass.testContext) klass.df = komodo.enrollment.getInstance(klass.testContext) klass.verification = Verification(klass) klass.pgModel = klass.testContext['implantable'] klass.commModel = komodo.enrollment.enrollmentbase.EXTERNAL_TO_MODEL_MAPPING[klass.testContext['external']] klass.wsModel = komodo.enrollment.enrollmentbase.EXTERNAL_TO_WEIGHT_SCALE_MAPPING[klass.testContext['external']] klass.bpModel = komodo.enrollment.enrollmentbase.EXTERNAL_TO_BP_MONITOR_MAPPING[klass.testContext['external']][0] # Randomly choose a country to use when needed if klass.testContext['country'] is None: klass.country = random.choice(komodo.enrollment.enrollmentbase.EXTERNAL_TO_COUNTRIES_MAPPING[klass.testContext['external']]) else: klass.country = klass.testContext['country'] if perseus.availability.evaluate('Japan'): klass.language = komodo.enrollment.enrollment.ENGLISH elif perseus.availability.evaluate('US'): klass.language = komodo.enrollment.enrollment.ENGLISH elif perseus.availability.evaluate('CA'): klass.language = komodo.enrollment.enrollment.ENGLISH elif perseus.availability.evaluate('AU'): klass.language = komodo.enrollment.enrollment.ENGLISH elif perseus.availability.evaluate('EU'): klass.language = komodo.enrollment.enrollment.ITALIANO if perseus.availability.evaluate('Brazil') and klass.country.name == 'Brazil': klass.language = komodo.enrollment.enrollment.ENGLISH elif perseus.availability.evaluate('Israel') and klass.country.name == 'Israel': klass.language = komodo.enrollment.enrollment.ENGLISH else: # Just assume Israel klass.language = komodo.enrollment.enrollment.ENGLISH klass.panda = komodo.panda.getInstance(klass.testContext)
def setUp(self): self.tc = komodo.getTestContext() self.regEnv = komodo.environment.getInstance(perseus.testharness.getOptParam()['regenv']) self.fakeuser = "******" self.user = os.environ.get("USERNAME") self.trace("CLKA00000")
def setUp(self): self.testContext = komodo.getTestContext() self.enroll = komodo.enrollment.getInstance(self.testContext) self.dwi = komodo.dragonweb.getInstance(self.testContext, throwExceptions=True) self.clock = komodo.clockadvance.getInstance(self.testContext, totalNumberOfDaysNeeded=1)
def setUp(self): self.testContext = komodo.getTestContext() self.enroll = komodo.enrollment.getInstance(self.testContext) self.shortcutInstance = komodo.shortcuts.Shortcuts(self.testContext) self.dwi = komodo.dragonweb.getInstance(self.testContext, throwExceptions=True)