def test_call_positive(self): """Test call obj positive result.""" obj = Task() obj.setup = mock.Mock() obj.execute = mock.Mock() obj.teardown = mock.Mock() obj()
def test_call_exception_while_executing(self, debug_mock): """Test call obj exception raised while executing.""" obj = Task() obj.setup = mock.Mock() obj.execute = _raise_exception obj.teardown = mock.Mock() obj() debug_mock.assert_called_once()
def test_call_exception_while_executing(self): """Test call obj exception raised while executing.""" obj = Task() with mock.patch.object(obj.logger, "debug") as debug_mock: obj.setup = mock.Mock() obj.execute = _raise_exception obj.teardown = mock.Mock() obj() debug_mock.assert_called_once()
def test_result_not_executed(self): """Test result property task not executed.""" obj = Task() with self.assertRaises(ValueError): obj.result
def test_result_positive(self): """Test result property positive result.""" obj = Task() obj._is_executed = True obj.result
def test_is_executed_positive(self): """Test is_executed property positive result.""" obj = Task() obj.is_executed
def test_call_already_executed(self): """Test call obj already executed.""" obj = Task() obj._is_executed = True with self.assertRaises(ValueError): obj()