Add test for hints.uppercase yaml migration

This commit is contained in:
Kristian Wallgren 2023-04-23 11:52:31 +03:00
parent 234602cea4
commit 2760accc67
1 changed files with 34 additions and 0 deletions

View File

@ -879,6 +879,40 @@ class TestYamlMigrations:
'content.media.video_capture']:
assert data[setting]['global'] == val
@pytest.mark.parametrize('chars, uppercase', [
('aoeuidnths', True),
('abcdefghijklmnopqrstuvwxyz', True),
(None, True),
('aoeuidnths', False),
('abcdefghijklmnopqrstuvwxyz', False),
(None, False),
('aoeuidnths', None),
('abcdefghijklmnopqrstuvwxyz', None),
(None, None),
])
def test_hints_uppercase(self, yaml, autoconfig, chars, uppercase):
settings = {}
if chars is not None:
settings['hints.chars'] = {'global': chars}
if uppercase is not None:
settings['hints.uppercase'] = {'global': uppercase}
autoconfig.write(settings)
yaml.load()
yaml._save()
data = autoconfig.read()
if uppercase:
if 'hints.chars' in data:
labels = data['hints.chars']['global'].upper()
assert data['hints.labels']['global'] == labels
else:
labels = configdata.DATA['hints.chars'].default.upper()
assert data['hints.labels']['global'] == labels
else:
assert 'hints.labels' not in data
def test_empty_pattern(self, yaml, autoconfig):
valid_pattern = 'https://example.com/*'
invalid_pattern = '*://*./*'