def test_config_serialization(): config = Config([ DotFile(name='.vimrc', target='~/_vimrc', action='symlink'), DotFile(name='.bashrc', action='include'), DotFile(name='rc.conf', target='.config/openbox/rc.conf', action='copy') ]) expected_string = """\ dotfiles: - name: .vimrc target: ~/_vimrc action: symlink - name: .bashrc target: ~/.bashrc action: include - name: rc.conf target: .config/openbox/rc.conf action: copy """ eq_(expected_string, config.to_yaml())
def test_init(): with temp_cwd(prefix='pot-test'): make_hierarchy({ 'dotfiles': { '.gitconfig': '', '.vimrc': '', '.vim': {}, } }) pot.init(path='.') expected_config = Config(dotfiles=[DotFile('.gitconfig'), DotFile('.vimrc'), DotFile('.vim'), ]) with open('config.yaml') as fd: builded_config = Config.from_yaml(fd) eq_(expected_config, builded_config)