def test_filterCamera(self, mock_tilecallback, mock_set):
        """Test filterCamera."""
        op = settilecallback.SetTileCallback(None)

        op.filterCamera()

        mock_set.assert_called_with("render:tilecallback", mock_tilecallback.return_value)
    def test_tilecallback(self):
        """Test 'tilecallback' property."""
        op = settilecallback.SetTileCallback(None)

        mock_value = MagicMock(spec=str)
        op._tilecallback = mock_value
        self.assertEqual(op.tilecallback, mock_value)
    def test_should_run(self):
        """Test if the operation should run when a path is set."""
        mock_path = MagicMock(spec=str)

        op = settilecallback.SetTileCallback(None)
        op._tilecallback = mock_path

        self.assertTrue(op.should_run())
    def test___init__(self, mock_super_init):
        """Test constructor."""
        mock_manager = MagicMock(spec=PyFilterManager)

        op = settilecallback.SetTileCallback(mock_manager)

        mock_super_init.assert_called_with(mock_manager)

        self.assertIsNone(op._tilecallback)
    def test_process_parsed_args_noop(self):
        """Test processing the args when the tilecallback arg is None."""
        mock_namespace = MagicMock(spec=argparse.Namespace)
        mock_namespace.tilecallback = None

        op = settilecallback.SetTileCallback(None)
        op._tilecallback = None

        op.process_parsed_args(mock_namespace)

        self.assertIsNone(op._tilecallback)
Пример #6
0
    def test___init__(self, mocker):
        """Test object initialization."""
        mock_super_init = mocker.patch.object(
            settilecallback.PyFilterOperation, "__init__")

        mock_manager = mocker.MagicMock(spec=PyFilterManager)

        op = settilecallback.SetTileCallback(mock_manager)

        mock_super_init.assert_called_with(mock_manager)

        assert op._tilecallback is None
    def test_process_parsed_args(self):
        """Test processing the args when the tilecallback arg is set to a value."""
        mock_path = MagicMock(spec=str)

        mock_namespace = MagicMock(spec=argparse.Namespace)
        mock_namespace.tilecallback = mock_path

        op = settilecallback.SetTileCallback(None)
        op._tilecallback = None

        op.process_parsed_args(mock_namespace)

        self.assertEqual(op._tilecallback, mock_path)
Пример #8
0
 def _create():
     return settilecallback.SetTileCallback(None)
    def test_should_run__no_op(self):
        """Test if the operation should run when a path is not set."""
        op = settilecallback.SetTileCallback(None)
        op._tilecallback = None

        self.assertFalse(op.should_run())