Пример #1
0
 def testRunDeleteCascade(self):
     '''
     Make sure that deleting a run will delete the steps as well (and leave steps from other runs)
     '''
     run = {
         'name'   : 'runname'
     }
     r = Run(name=run['name'])
     teststore.save(r)
     
     for i in xrange(1,5):
         teststore.save(Step(run_name=run['name'],cmdid='cmd%d' % i, cmd='hostname'))
     
     r2 = Run(name='runname10')
     teststore.save(r2)
     teststore.save(Step(run_name='runname10',cmdid='cmd10',cmd='hostname'))
     
     n = teststore.session.query(Step).filter_by(run_name=run['name']).count()
     self.assertTrue(n == 4, 'Step count should be 4 instead of %d' % n)
     
     teststore.session.query(Run).filter_by(name=run['name']).delete()
     n = teststore.session.query(Step).filter_by(run_name=run['name']).count()
     self.assertTrue(n == 0, 'Step count should be 0 instead of %d' % n)
     
     n = teststore.session.query(Step).filter_by(run_name='runname10').count()
     self.assertTrue(n == 1, 'Step count should be 1 instead of %d' % n)
Пример #2
0
 def testRunTableWorkflowDefault(self):
     '''
     Make sure workflow name default gets set properly
     '''
     
     vals = {
         'name'          : 'ajkrun',
     }
     defaultworkflow = 'adhoc'
     
     
     r = Run()
     r.name          = vals['name']
     
     teststore.save(r)
     
     rresult = teststore.session.query(Run).filter_by(name=vals['name']).first()
     self.assertTrue(rresult.name == vals['name'], 'Incorrect name %s' % rresult.name)
     self.assertTrue(rresult.workflow_name == defaultworkflow,'Default workflow is %s instead of %s' % (rresult.workflow_name,defaultworkflow))
    def testWorkflowTable(self):
        '''
        Make sure display name gets set properly
        '''
        
        vals = {
            'name'          : 'ajk',
            'definition'    : '{json document for testing}',
        }
        w = Workflow()
        w.name          = vals['name']
        w.definition    = vals['definition']
        
        teststore.save(w)

        w = Workflow(name='jak',definition='def')
        teststore.save(w)
        
        wresult = teststore.session.query(Workflow).filter_by(name=vals['name']).first()
        self.assertTrue(wresult.name == vals['name'], 'Incorrect name %s' % wresult.name)
        self.assertTrue(wresult.display_name == vals['name'],'Display name is %s instead of %s' % (wresult.display_name,vals['name']))
Пример #4
0
 def setUp(self):
     teststore.clean()
     
     teststore.save(Workflow(name='adhoc'))