def test_get_touchpad_defaults_existing_without_filename(tmpdir): with config_home(tmpdir): defaults_file = py.path.local(config.get_touchpad_defaults_file_path()) data = {'spam': 'eggs'} defaults_file.write(json.dumps(data)) assert defaults_file.check(exists=True, file=True) assert config.get_touchpad_defaults() == data
def test_defaults(self, tmpdir, touchpad_config): with config_home(tmpdir): defaults_file = py.path.local( config.get_touchpad_defaults_file_path()) data = {'spam': 'eggs'} defaults_file.write(json.dumps(data)) assert touchpad_config.defaults == data
def test_get_touchpad_defaults_existing_without_filename(tmpdir): with config_home(tmpdir): defaults_file = py.path.local(config.get_touchpad_defaults_file_path()) data = {"spam": "eggs"} defaults_file.write(json.dumps(data)) assert defaults_file.check(exists=True, file=True) assert config.get_touchpad_defaults() == data
def test_delitem(self, tmpdir, touchpad_config, key): with config_home(tmpdir): defaults_file = py.path.local(config.get_touchpad_defaults_file_path()) keys = config.TouchpadConfiguration.CONFIG_KEYS defaults_file.write(json.dumps(dict((k, "default") for k in keys))) assert touchpad_config[key] != "default" del touchpad_config[key] assert touchpad_config[key] == "default"
def test_delitem(self, tmpdir, touchpad_config, key): with config_home(tmpdir): defaults_file = py.path.local( config.get_touchpad_defaults_file_path()) keys = config.TouchpadConfiguration.CONFIG_KEYS defaults_file.write(json.dumps(dict((k, 'default') for k in keys))) assert touchpad_config[key] != 'default' del touchpad_config[key] assert touchpad_config[key] == 'default'
def test_get_touchpad_defaults_file_path(tmpdir): with config_home(tmpdir): assert_config_file_path(config.get_touchpad_defaults_file_path(), 'touchpad-defaults.json')
def test_defaults(self, tmpdir, touchpad_config): with config_home(tmpdir): defaults_file = py.path.local(config.get_touchpad_defaults_file_path()) data = {"spam": "eggs"} defaults_file.write(json.dumps(data)) assert touchpad_config.defaults == data
def test_get_touchpad_defaults_file_path(tmpdir): with config_home(tmpdir): assert_config_file_path(config.get_touchpad_defaults_file_path(), "touchpad-defaults.json")