tests: relax pdfjs tests

Updating the whole snippet in two places is bad, so we relax the testing
code.
This commit is contained in:
Daniel Schadt 2016-10-06 16:18:21 +02:00
parent ffa276a182
commit a9ac123bfa

View File

@ -36,11 +36,11 @@ from qutebrowser.browser import pdfjs
'http://foobar/%22);alert(%22attack!%22);'),
])
def test_generate_pdfjs_script(url, expected):
expected_code = ('PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n'
'PDFView.open("{}");\n'.format(expected))
expected_open = 'open("{}");'.format(expected)
url = QUrl(url)
actual = pdfjs._generate_pdfjs_script(url)
assert actual == expected_code
assert expected_open in actual
assert 'PDFView' in actual
def test_fix_urls():