From 1663280f531c95105e7790d1f1d783041a2880cb Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 3 Jul 2017 18:38:41 +0200 Subject: [PATCH] Update test_shared for new config Also, make accept_language none_ok=True like it was in the old configdata.py --- qutebrowser/config/configdata.yml | 4 +++- tests/unit/browser/test_shared.py | 13 ++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 6751b233b..08879a7d4 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -207,7 +207,9 @@ content.geolocation: desc: Allow websites to request geolocations. content.headers.accept_language: - type: String + type: + name: String + none_ok: true default: en-US,en desc: Value to send in the `Accept-Language` header. diff --git a/tests/unit/browser/test_shared.py b/tests/unit/browser/test_shared.py index 8cd1d6704..7d7da1d13 100644 --- a/tests/unit/browser/test_shared.py +++ b/tests/unit/browser/test_shared.py @@ -26,6 +26,7 @@ from qutebrowser.browser import shared # DNT (True, None, {}, {b'DNT': b'1', b'X-Do-Not-Track': b'1'}), (False, None, {}, {b'DNT': b'0', b'X-Do-Not-Track': b'0'}), + (None, None, {}, {}), # Accept-Language (False, 'de, en', {}, {b'DNT': b'0', b'X-Do-Not-Track': b'0', b'Accept-Language': b'de, en'}), @@ -40,12 +41,10 @@ from qutebrowser.browser import shared ]) def test_custom_headers(config_stub, dnt, accept_language, custom_headers, expected): - config_stub.data = { - 'network': { - 'do-not-track': dnt, - 'accept-language': accept_language, - 'custom-headers': custom_headers, - } - } + headers = config_stub.val.content.headers + headers.do_not_track = dnt + headers.accept_language = accept_language + headers.custom = custom_headers + expected_items = sorted(expected.items()) assert shared.custom_headers() == expected_items