예제 #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()
예제 #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()
예제 #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()
예제 #4
0
 def test_result_not_executed(self):
     """Test result property task not executed."""
     obj = Task()
     with self.assertRaises(ValueError):
         obj.result
예제 #5
0
 def test_result_positive(self):
     """Test result property positive result."""
     obj = Task()
     obj._is_executed = True
     obj.result
예제 #6
0
 def test_is_executed_positive(self):
     """Test is_executed property positive result."""
     obj = Task()
     obj.is_executed
예제 #7
0
 def test_call_already_executed(self):
     """Test call obj already executed."""
     obj = Task()
     obj._is_executed = True
     with self.assertRaises(ValueError):
         obj()