def REQ002(self):
        
        # Test missing required argumentes
        self.trace('REQ002')
        testException(self, msg='No required arguments present', requirement="REQ002")
        testException(self, '-x %s -i %s' %(external, implantable), requirement="REQ002", msg='environment missing')
        testException(self, '-e %s -i %s' %(environment, implantable), requirement="REQ002", msg='external missing')
        testException(self, '-e %s -x %s' %(environment, external), requirement="REQ002", msg='implantable missing')
        testException(self, "-e %s -x %s -i %s -p pgsim='true'" %(environment, external, implantable), requirement="REQ002", msg='incorrect optional value')
        testException(self, "-e %s -x %s -i %s -p pgsim=otherVal" %(environment, external, implantable), requirement="REQ002", msg='incorrect optional value')
        testException(self, "-e %s -x %s -i %s -p pgsim=True,brwsr=False" %(environment, external, implantable), requirement="REQ002", msg='incorrect optional value')

        # Test optional parameter defaults
        argDict = {'env':self.env, 'external':external, 'implantable':implantable}
        testDefaultSuccess(self, argDict, requirement="REQ002", msg='default parameters')
        
        # Test correct command lines
        argDict = {'env':self.env, 'external':external, 'implantable':implantable}
        testSuccess(self, argDict, requirement="REQ002")
        argDict = {'env':self.env, 'external':external, 'implantable':implantable, 'pgsim':True}
        testSuccess(self, argDict, requirement="REQ002")
        argDict = {'env':self.env, 'external':external, 'implantable':implantable, 'pgsim':False}
        testSuccess(self, argDict, requirement="REQ002")
        argDict = {'env':self.env, 'external':external, 'implantable':implantable, 'debug': '-d'}
        testSuccess(self, argDict, requirement="REQ002")
        
        # Test Setup method
        commandString = '-e %s -x %s -i %s' % (self.env.name, external, implantable)
        setCommandLine(commandString)          
        
        # Create a class to attach the objects that will be setup by KomodoRS
        class DummyObject(object):
            pass
        
        try:
            dObj = DummyObject()
            komodors.komodoRSSetUp(dObj)
            self.verifyTrue(hasattr(dObj, 'context'), msg='context added to object')
            self.verifyEqual(type(dObj.context), dict, msg='context type')
            self.verifyTrue(hasattr(dObj, 'brwsr'), msg='browser added to object')
            self.verifyEqual(type(dObj.brwsr), komodors.pocweb.Browser, msg='browser type')
            self.verifyTrue(hasattr(dObj, 'dataFactory'), msg='enrollment added to object')
            self.verifyEqual(type(dObj.dataFactory), komodors.enrollment.RockSpringsEnroller, msg='enrollment type')

        except:
            self.log.exception()
            self.verifyFailed(msg='komodoRSSetUp failure')
            raise # Test cannot go on from here
        
        # Test TearDown
        # As this method only breaks things down, it is only necessary to test that the
        # method handles all internal exceptions correctly.
        try:
            komodors.komodoRSTearDown(dObj)
            self.verified(msg='komodoRSTearDown success')
        except:
            self.log.exception()
            self.verifyFailed(msg='komodoRSTearDown failure')
            raise
Exemple #2
0
 def setUp(self):
     setDefaultCommandLine()
     komodors.komodoRSSetUp(self)
     
     # Create a scenario with data
     self.pocuser = self.dataFactory.createUser(self.brwsr)
     self.commEntity = self.dataFactory.createPOCCommunicator()
     self.pgEntity = self.dataFactory.createPG()
     self.comm, self.pg = initializeHardware(self.context,
                                             self.commEntity,
                                             self.pgEntity,
                                             interrogate=True)
    def setUp(self):

        # Setup the KomodoRS environment before running the test case. This
        # method attaches:
        #    1. A POCWeb instance to self.brwsr
        #    2. A enrollment instance to self.dataFactory
        #    3. A context dictionary to self.context
        #
        # See the documentation for more information about the KomodoRS context
        # dictionary and its contents.
        #
        # This bootstrap is required to be called before using KomodoRS.
        komodors.komodoRSSetUp(self)
 def setUp(self):
     setDefaultCommandLine()
     komodors.komodoRSSetUp(self)
 def setUp(self):
     setDefaultCommandLine()
     komodors.komodoRSSetUp(self)
     self.env = self.context['env']