def test_migrate_config_file(): spec = YapconfSpec({'foo': {'bootstrap': True}}) with patch('yapconf.open', mock_open(read_data='{}')): config = spec.migrate_config_file('/path/to/file', create=False, include_bootstrap=False) assert config == {}
def test_migrate_config_file_update_previous_default(): spec = YapconfSpec( {'foo': { 'default': 'baz', 'previous_defaults': ['bar'] }}) open_path = builtins_path + '.open' current_config = '{"foo": "bar"}' with patch(open_path, mock_open(read_data=current_config)): new_config = spec.migrate_config_file('/path/to/file', create=False, update_defaults=True) assert new_config == {'foo': 'baz'}