mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
create non-ascii filename test cases dynamically instead of static PDF
originally PDF files were included for these edge-cases but in reality all we want to test is the filename itself. So it reduces repo size if we have them generated dynamically.
This commit is contained in:
parent
d5eefeab3d
commit
0f4e6e9156
1 changed files with 17 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -68,3 +70,18 @@ class TestCliConversion(TestCliBasic):
|
||||||
def test_lang_eng(self):
|
def test_lang_eng(self):
|
||||||
result = self.run_cli(f'"{self.sample_doc}" --ocr-lang eng')
|
result = self.run_cli(f'"{self.sample_doc}" --ocr-lang eng')
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"filename,",
|
||||||
|
[
|
||||||
|
"“Curly_Quotes”.pdf", # issue 144
|
||||||
|
"Оригинал.pdf",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_filenames(self, filename):
|
||||||
|
tempdir = tempfile.mkdtemp(prefix="dangerzone-")
|
||||||
|
doc_path = os.path.join(filename)
|
||||||
|
shutil.copyfile(self.sample_doc, doc_path)
|
||||||
|
result = self.run_cli(doc_path)
|
||||||
|
shutil.rmtree(tempdir)
|
||||||
|
assert result.exit_code == 0
|
||||||
|
|
Loading…
Reference in a new issue