tests: assert that most patched functions are called

We were not actually checking if functions we patched we called when
expected.
This commit is contained in:
James R. Barlow
2020-12-28 23:58:33 -08:00
parent 0ff0d2f8d1
commit babc76fa74
13 changed files with 71 additions and 27 deletions
+3 -1
View File
@@ -141,7 +141,8 @@ def test_multiple_pngs(resources, outdir):
draw.rectangle((0, 0, im.width, im.height), fill=128)
im.save(output_file)
with patch('ocrmypdf.optimize.pngquant.quantize', new=mockquant):
with patch('ocrmypdf.optimize.pngquant.quantize') as mock:
mock.side_effect = mockquant
check_ocrmypdf(
outdir / 'in.pdf',
outdir / 'out.pdf',
@@ -155,6 +156,7 @@ def test_multiple_pngs(resources, outdir):
'--plugin',
'tests/plugins/tesseract_noop.py',
)
mock.assert_called()
with pikepdf.open(outdir / 'in.pdf') as inpdf, pikepdf.open(
outdir / 'out.pdf'