def test_cancel(self): # Test task_id = '123' agent = RestAgent(CONSUMER) agent.cancel(task_id) # Verify criteria = {'eq': task_id} mock_agent.Admin.cancel.assert_called_once_with(criteria=criteria)
def test_status(self, mock_rest): # Test result = RestAgent.status(['A', 'B']) # Verify self.assertEqual(len(result), 2) # A alive, next_heartbeat, details = result['A'] self.assertTrue(alive) self.assertTrue(isinstance(next_heartbeat, basestring)) self.assertTrue(isinstance(details, dict)) # B alive, last_heartbeat, details = result['B'] self.assertFalse(alive) self.assertTrue(last_heartbeat is None) self.assertTrue(isinstance(details, dict))