tests: Fail if duckduckgo gets loaded accidentally

In the long run, we should detect any accidental external accesses using
mitmproxy, as per #1282. In the meantime, we try to detect duckduckgo requests
being logged and fail the tests if that happens.

However, a duckduckgo URL is logged in fuzzy_url during startup/config init,
which is why we ignore it there.
This commit is contained in:
Florian Bruhin 2016-02-03 06:50:48 +01:00
parent 1e52f459c9
commit af28996f82

View File

@ -237,7 +237,13 @@ class QuteProc(testprocess.Process):
msg.function == 'javaScriptConsoleMessage' and
testutils.pattern_match(pattern='[*] [FAIL] *',
value=msg.message))
return msg.loglevel > logging.INFO or is_js_error
# Try to complain about the most common mistake when accidentally
# loading external resources. A fuzzy_url line gets logged when
# initializing settings though, so ignore those.
is_ddg_page = ('duckduckgo' in msg.message and not
(msg.module == 'urlutils' and
msg.function == 'fuzzy_url'))
return msg.loglevel > logging.INFO or is_js_error or is_ddg_page
def _maybe_skip(self):
"""Skip the test if [SKIP] lines were logged."""