def test_save_without_filename(self, touchpad_config, tmpdir): keys = touchpad_config.CONFIG_KEYS for key in keys: setattr(touchpad_config.touchpad, key, key) with config_home(tmpdir): touchpad_config.save() config_file = py.path.local(config.get_touchpad_config_file_path()) contents = json.loads(config_file.read()) assert contents == dict((k, k) for k in keys)
def test_load_without_filename_existing(self, tmpdir, manager_config_sample): with config_home(tmpdir): config_file = py.path.local(config.get_touchpad_config_file_path()) keys = config.TouchpadConfiguration.CONFIG_KEYS config_file.write(json.dumps(dict((k, k) for k in keys))) touchpad = mock.Mock(name="Touchpad", spec_set=list(keys)) touchpad_config = config.TouchpadConfiguration.load(touchpad) assert touchpad_config.touchpad is touchpad assert all(getattr(touchpad, k) == k for k in keys)
def test_load_without_filename_existing(self, tmpdir, manager_config_sample): with config_home(tmpdir): config_file = py.path.local(config.get_touchpad_config_file_path()) keys = config.TouchpadConfiguration.CONFIG_KEYS config_file.write(json.dumps(dict((k, k) for k in keys))) touchpad = mock.Mock(name='Touchpad', spec_set=list(keys)) touchpad_config = config.TouchpadConfiguration.load(touchpad) assert touchpad_config.touchpad is touchpad assert all(getattr(touchpad, k) == k for k in keys)
def test_get_touchpad_config_file_path(tmpdir): with config_home(tmpdir): assert_config_file_path(config.get_touchpad_config_file_path(), 'touchpad-config.json')
def test_get_touchpad_config_file_path(tmpdir): with config_home(tmpdir): assert_config_file_path(config.get_touchpad_config_file_path(), "touchpad-config.json")