mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00

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.
33 lines
904 B
Python
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)
|