示例#1
0
 def testGetTaskStatus(self):
     "Get the task status ""in progress"" or ""finished"" "
     taskName = "task_one"
     taskParameter = {"param1": "hello", "param2": "world"}
     maxSize = 3
     deviceHolder = DeviceHolder( maxSize
         
                                )
     deviceHolder._deviceList = [ self.deviceOne, self.deviceTwo]
     taskResult = { 'duration': 5
                  , 'result': {'result_0': 10, 'result_1': None}
                  }
     self.deviceOne._openTaskDict = { taskName: taskParameter}
     self.deviceTwo._openTaskDict = { taskName: taskParameter}
     self.assertTrue( deviceHolder.devicesFinished(taskName) == False
                    , msg = "task shouldn't be finished"
                    )
     self.deviceOne._finishedTaskDict = { taskName: taskResult}
     self.deviceOne._openTaskDict = {}
     self.assertTrue( deviceHolder.devicesFinished(taskName) == False
                    , msg = "task shouldn't be finished"
                    )
     self.deviceTwo._finishedTaskDict = { taskName: taskResult}
     self.deviceTwo._openTaskDict = {}
     self.assertTrue( deviceHolder.devicesFinished(taskName) == True
                    , msg = "task should be finished"
                    )
示例#2
0
 def testGetTaskProgress(self):
     " Get the number of already finished device and the amout of devices, where we have sent the task."
     " Get the task status ""in progress"" or ""finished"" "
     taskName = "task_one"
     taskParameter = {"param1": "hello", "param2": "world"}
     maxSize = 3
     deviceHolder = DeviceHolder(maxSize)
     deviceHolder._deviceList = [ self.deviceOne, self.deviceTwo]
     taskResult = { 'duration': 5
                  , 'result': {'result_0': 10, 'result_1': None}
                  }
     self.deviceOne._openTaskDict = { taskName: taskParameter}
     self.deviceTwo._openTaskDict = { taskName: taskParameter}
     self.assertTrue( deviceHolder.get_taskProgress(taskName) == 0
                    , msg = "wrong task progress"
                    )
     self.deviceOne._finishedTaskDict = { taskName: taskResult}
     self.deviceOne._openTaskDict = {}
     self.deviceTwo._finishedTaskDict = { taskName: taskResult}
     self.deviceTwo._openTaskDict = {}
     self.assertTrue( deviceHolder.get_taskProgress(taskName) == 2
                    , msg = "wrong task progress"
                    )