Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 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()