From 77035851a36fe1aca60b166fb53605d18242ffd6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 12 Jul 2016 13:28:43 +0200 Subject: [PATCH] Sanity check the PDF file for :print --pdf test --- tests/end2end/features/misc.feature | 2 +- tests/end2end/features/test_misc_bdd.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index a0f3eced5..48f51aa43 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -343,7 +343,7 @@ Feature: Various utility commands. When I open data/hello.txt And I run :print --pdf (tmpdir)/hello.pdf And I wait for "Print to file: *" in the log or skip the test - Then the file hello.pdf should exist in the tmpdir + Then the PDF hello.pdf should exist in the tmpdir # :pyeval diff --git a/tests/end2end/features/test_misc_bdd.py b/tests/end2end/features/test_misc_bdd.py index 9ada5e484..f9cd50766 100644 --- a/tests/end2end/features/test_misc_bdd.py +++ b/tests/end2end/features/test_misc_bdd.py @@ -75,7 +75,8 @@ def check_cookie(quteproc, name, value): assert data['cookies'][name] == value -@bdd.then(bdd.parsers.parse('the file {filename} should exist in the tmpdir')) -def file_exists(quteproc, tmpdir, filename): +@bdd.then(bdd.parsers.parse('the PDF {filename} should exist in the tmpdir')) +def pdf_exists(quteproc, tmpdir, filename): path = tmpdir / filename - assert os.path.exists(str(path)) + data = path.read_binary() + assert data.startswith(b'%PDF')