Refactor tests for bool setting migrations
This commit is contained in:
parent
dcd2184f97
commit
2c1d039c9e
@ -250,36 +250,24 @@ class TestYaml:
|
|||||||
data = autoconfig.read()
|
data = autoconfig.read()
|
||||||
assert data['content.webrtc_ip_handling_policy']['global'] == expected
|
assert data['content.webrtc_ip_handling_policy']['global'] == expected
|
||||||
|
|
||||||
@pytest.mark.parametrize('show, expected', [
|
@pytest.mark.parametrize('setting, old, new', [
|
||||||
(True, 'always'),
|
('tabs.favicons.show', True, 'always'),
|
||||||
(False, 'never'),
|
('tabs.favicons.show', False, 'never'),
|
||||||
('always', 'always'),
|
('tabs.favicons.show', 'always', 'always'),
|
||||||
('never', 'never'),
|
|
||||||
('pinned', 'pinned'),
|
('qt.force_software_rendering', True, 'software-opengl'),
|
||||||
|
('qt.force_software_rendering', False, 'none'),
|
||||||
|
('qt.force_software_rendering', 'chromium', 'chromium'),
|
||||||
])
|
])
|
||||||
def test_tabs_favicons_show(self, yaml, autoconfig, show, expected):
|
def test_bool_migrations(self, yaml, autoconfig, setting, old, new):
|
||||||
"""Tests for migration of tabs.favicons.show."""
|
"""Tests for migration of former boolean settings."""
|
||||||
autoconfig.write({'tabs.favicons.show': {'global': show}})
|
autoconfig.write({setting: {'global': old}})
|
||||||
|
|
||||||
yaml.load()
|
yaml.load()
|
||||||
yaml._save()
|
yaml._save()
|
||||||
|
|
||||||
data = autoconfig.read()
|
data = autoconfig.read()
|
||||||
assert data['tabs.favicons.show']['global'] == expected
|
assert data[setting]['global'] == new
|
||||||
|
|
||||||
@pytest.mark.parametrize('force, expected', [
|
|
||||||
(True, 'software-opengl'),
|
|
||||||
(False, 'none'),
|
|
||||||
('chromium', 'chromium'),
|
|
||||||
])
|
|
||||||
def test_force_software_rendering(self, yaml, autoconfig, force, expected):
|
|
||||||
autoconfig.write({'qt.force_software_rendering': {'global': force}})
|
|
||||||
|
|
||||||
yaml.load()
|
|
||||||
yaml._save()
|
|
||||||
|
|
||||||
data = autoconfig.read()
|
|
||||||
assert data['qt.force_software_rendering']['global'] == expected
|
|
||||||
|
|
||||||
def test_renamed_key_unknown_target(self, monkeypatch, yaml,
|
def test_renamed_key_unknown_target(self, monkeypatch, yaml,
|
||||||
autoconfig):
|
autoconfig):
|
||||||
|
Loading…
Reference in New Issue
Block a user