test/system/test_cvp_api.py
def _execute_task(self, task_id):
        ''' Execute a task and wait for it to complete.
        '''
        # Test add_note_to_task
        self.api.add_note_to_task(task_id, 'Test Generated')

        self.api.execute_task(task_id)

        # Verify task executed within 30 seconds
        cnt = 30
        while cnt > 0:
            time.sleep(1)
            result = self.api.get_task_by_id(task_id)
            status = result['workOrderUserDefinedStatus']
            if status == 'Completed' or status == 'Failed':
                break
            cnt -= 1
        err_msg = 'Execution for task id %s failed' % task_id
        self.assertNotEqual(status, 'Failed', msg=err_msg)
        err_msg = 'Timeout waiting for task id %s to execute' % task_id
        self.assertGreater(cnt, 0, msg=err_msg)
 Execute a task and wait for it to complete.
        
Execute a task and wait for it to complete.
Execute a task and wait for it to complete .
def _execute_task(self, task_id):
        self.api.add_note_to_task(task_id, 'Test Generated')
        self.api.execute_task(task_id)
        cnt = 30
        while cnt > 0:
            time.sleep(1)
            result = self.api.get_task_by_id(task_id)
            status = result['workOrderUserDefinedStatus']
            if status == 'Completed' or status == 'Failed':
                break
            cnt -= 1
        err_msg = 'Execution for task id %s failed' % task_id
        self.assertNotEqual(status, 'Failed', msg=err_msg)
        err_msg = 'Timeout waiting for task id %s to execute' % task_id
        self.assertGreater(cnt, 0, msg=err_msg)
def _execute_task ( self , task_id ) : self . api . add_note_to_task ( task_id , 'Test Generated' ) self . api . execute_task ( task_id ) cnt = 30 while cnt > 0 : time . sleep ( 1 ) result = self . api . get_task_by_id ( task_id ) status = result [ 'workOrderUserDefinedStatus' ] if status == 'Completed' or status == 'Failed' : break cnt -= 1 err_msg = 'Execution for task id %s failed' % task_id self . assertNotEqual ( status , 'Failed' , msg = err_msg ) err_msg = 'Timeout waiting for task id %s to execute' % task_id self . assertGreater ( cnt , 0 , msg = err_msg )
Execute a task and wait for it to complete.
Execute a task and wait for it to complete .
''' Execute a task and wait for it to complete.
        ''' # Test add_note_to_task # Verify task executed within 30 seconds
self
task_id