dangerzone/tests/isolation_provider/test_dummy.py
Alex Pyrgiotis 6e55e43fef
Make Dummy isolation provider more realistic
Make the Dummy isolation provider follow the rest of the isolation
providers and perform the second part of the conversion on the host. The
first part of the conversion is just a dummy script that reads a file
from stdin and prints pixels to stdout.
2024-10-17 15:50:12 +03:00

33 lines
904 B
Python

import os
import pytest
from pytest_mock import MockerFixture
from dangerzone.conversion import errors
from dangerzone.isolation_provider.base import IsolationProvider
from dangerzone.isolation_provider.dummy import Dummy
from .base import IsolationProviderTermination
# Run the tests in this module only if dummy conversion is enabled.
if not os.environ.get("DUMMY_CONVERSION", False):
pytest.skip("Dummy conversion is not enabled", allow_module_level=True)
@pytest.fixture
def provider() -> Dummy:
return Dummy()
class TestDummyTermination(IsolationProviderTermination):
def test_failed(
self,
provider: IsolationProvider,
mocker: MockerFixture,
) -> None:
mocker.patch.object(
provider,
"get_proc_exception",
return_value=errors.DocFormatUnsupported(),
)
super().test_failed(provider, mocker)