diff options
author | Jon Bernard <jbernard@jbernard.io> | 2018-09-21 13:43:03 -0400 |
---|---|---|
committer | Jon Bernard <jbernard@jbernard.io> | 2018-09-21 13:43:03 -0400 |
commit | 3bac0654d81a51157efd1dc30dfbeb5c71cc22cd (patch) | |
tree | eb9eaac2655c4ccf5689d16c9453110797af2e78 | |
parent | 3fab5f723bc513e8467b15b2200a7cc63176dee1 (diff) | |
download | dotfiles-3bac0654d81a51157efd1dc30dfbeb5c71cc22cd.tar.gz dotfiles-3bac0654d81a51157efd1dc30dfbeb5c71cc22cd.tar.bz2 dotfiles-3bac0654d81a51157efd1dc30dfbeb5c71cc22cd.zip |
Fix state tests
-rw-r--r-- | tests/test_dotfile.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/tests/test_dotfile.py b/tests/test_dotfile.py index 9d04eed..fdb51da 100644 --- a/tests/test_dotfile.py +++ b/tests/test_dotfile.py @@ -24,31 +24,27 @@ def test_short_name(repo, name): assert dotfile.short_name(repo.homedir) == name -def test_state_error(repo): - dotfile = _dotfile(repo, '.vimrc') +def test_state(repo): + dotfile = _dotfile(repo, '.vimrc', 'vimrc') assert dotfile.state == 'error' - -def test_state_missing(repo): - dotfile = _dotfile(repo, '.vimrc') dotfile.target.ensure() - assert dotfile.state == 'missing' + dotfile.name.mksymlinkto(dotfile.target) + assert dotfile.state == 'ok' + dotfile.name.remove() + assert dotfile.state == 'missing' -def test_state_conflict(repo): - dotfile = _dotfile(repo, '.vimrc') - dotfile.target.ensure() dotfile.name.ensure() - assert dotfile.state == 'conflict' + assert dotfile.state == 'ok' + with open(dotfile.name, 'w') as f: + f.write('test content') + assert dotfile.state == 'conflict' -def test_state_ok(repo): - dotfile = _dotfile(repo, '.vimrc', 'vimrc') - dotfile.target.ensure() - dotfile.name.mksymlinkto(dotfile.target) + with open(dotfile.target, 'w') as f: + f.write('test content') assert dotfile.state == 'ok' - dotfile.name.remove() - assert dotfile.state == 'missing' @pytest.mark.parametrize('path', ['.foo', '.foo/bar/baz']) |