Skip to content

Commit

Permalink
Add test for hints.uppercase yaml migration
Browse files Browse the repository at this point in the history
  • Loading branch information
tcftbl committed Nov 8, 2023
1 parent 234602c commit 2760acc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/unit/config/test_configfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,40 @@ def test_content_media_capture(self, yaml, autoconfig):
'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 = '*://*./*'
Expand Down

0 comments on commit 2760acc

Please sign in to comment.