cover setting-saving-loading-getting yaml config

This commit is contained in:
Felix Van der Jeugt 2017-09-20 15:52:42 +02:00
parent 285b534384
commit 6892705e18
No known key found for this signature in database
GPG Key ID: 58B209295023754D

View File

@ -93,6 +93,37 @@ def test_yaml_config(fake_save_manager, config_tmpdir, old_config, insert):
assert ' tabs.show: never' in lines
@pytest.mark.parametrize('old_config', [
None,
'global:\n colors.hints.fg: magenta',
])
@pytest.mark.parametrize('key, value', [
('colors.hints.fg', 'green'),
('colors.hints.bg', None),
('confirm_quit', True),
('confirm_quit', False),
])
def test_yaml_config_changed(fake_save_manager, config_tmpdir, old_config, key, value):
autoconfig = config_tmpdir / 'autoconfig.yml'
if old_config is not None:
autoconfig.write_text(old_config, 'utf-8')
yaml = configfiles.YamlConfig()
yaml.load()
yaml[key] = value
assert key in yaml
assert yaml[key] == value
yaml._save()
yaml = configfiles.YamlConfig()
yaml.load()
assert key in yaml
assert yaml[key] == value
@pytest.mark.parametrize('old_config', [
None,
'global:\n colors.hints.fg: magenta',