Update test_shared for new config

Also, make accept_language none_ok=True like it was in the old configdata.py
This commit is contained in:
Florian Bruhin 2017-07-03 18:38:41 +02:00
parent 7dd5e4b2e6
commit 1663280f53
2 changed files with 9 additions and 8 deletions

View File

@ -207,7 +207,9 @@ content.geolocation:
desc: Allow websites to request geolocations. desc: Allow websites to request geolocations.
content.headers.accept_language: content.headers.accept_language:
type: String type:
name: String
none_ok: true
default: en-US,en default: en-US,en
desc: Value to send in the `Accept-Language` header. desc: Value to send in the `Accept-Language` header.

View File

@ -26,6 +26,7 @@ from qutebrowser.browser import shared
# DNT # DNT
(True, None, {}, {b'DNT': b'1', b'X-Do-Not-Track': b'1'}), (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'}), (False, None, {}, {b'DNT': b'0', b'X-Do-Not-Track': b'0'}),
(None, None, {}, {}),
# Accept-Language # Accept-Language
(False, 'de, en', {}, {b'DNT': b'0', b'X-Do-Not-Track': b'0', (False, 'de, en', {}, {b'DNT': b'0', b'X-Do-Not-Track': b'0',
b'Accept-Language': b'de, en'}), 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, def test_custom_headers(config_stub, dnt, accept_language, custom_headers,
expected): expected):
config_stub.data = { headers = config_stub.val.content.headers
'network': { headers.do_not_track = dnt
'do-not-track': dnt, headers.accept_language = accept_language
'accept-language': accept_language, headers.custom = custom_headers
'custom-headers': custom_headers,
}
}
expected_items = sorted(expected.items()) expected_items = sorted(expected.items())
assert shared.custom_headers() == expected_items assert shared.custom_headers() == expected_items