aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_dotfile.py28
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'])