diff options
author | Jon Bernard <jbernard@tuxion.com> | 2016-01-01 08:54:14 -0500 |
---|---|---|
committer | Jon Bernard <jbernard@tuxion.com> | 2016-01-01 08:55:33 -0500 |
commit | 3b7a6968d9be240c4ad4ec3d92bb99bc7fd888ef (patch) | |
tree | 02ca2d8958c2aa234d5c5a22344f1608f5c383b6 /tests/test_dotfile.py | |
parent | 916aaeee70af4a08181edad00875e3cb21c5917d (diff) | |
download | dotfiles-3b7a6968d9be240c4ad4ec3d92bb99bc7fd888ef.tar.gz dotfiles-3b7a6968d9be240c4ad4ec3d92bb99bc7fd888ef.tar.bz2 dotfiles-3b7a6968d9be240c4ad4ec3d92bb99bc7fd888ef.zip |
Implement dotfile state management
Diffstat (limited to 'tests/test_dotfile.py')
-rw-r--r-- | tests/test_dotfile.py | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/tests/test_dotfile.py b/tests/test_dotfile.py index 7b99db1..29908ba 100644 --- a/tests/test_dotfile.py +++ b/tests/test_dotfile.py @@ -73,7 +73,53 @@ def test_sync(tmpdir, times): assert name.samefile(target) -def test_valid(tmpdir): +def test_state_error(tmpdir): + + repo = tmpdir.ensure("Dotfiles", dir=1) + name = tmpdir.join(".vimrc") + target = repo.join("vimrc") + + dotfile = Dotfile(name, target) + + assert Dotfile.states['error'] == dotfile.state + + +def test_state_missing(tmpdir): + + repo = tmpdir.ensure("Dotfiles", dir=1) + name = tmpdir.join(".vimrc") + target = repo.ensure("vimrc") + + dotfile = Dotfile(name, target) + + assert Dotfile.states['missing'] == dotfile.state + + +def test_state_conflict(tmpdir): + + repo = tmpdir.ensure("Dotfiles", dir=1) + name = tmpdir.ensure(".vimrc") + target = repo.ensure("vimrc") + + dotfile = Dotfile(name, target) + + assert Dotfile.states['conflict'] == dotfile.state + + +def test_state_ok(tmpdir): + + repo = tmpdir.join("Dotfiles", dir=1) + name = tmpdir.join(".vimrc") + target = repo.ensure("vimrc") + + name.mksymlinkto(target) + + dotfile = Dotfile(name, target) + + assert Dotfile.states['ok'] == dotfile.state + + +def test_is_ok(tmpdir): repo = tmpdir.join("Dotfiles", dir=1) name = tmpdir.join(".vimrc") @@ -82,8 +128,8 @@ def test_valid(tmpdir): dotfile = Dotfile(name, target) - assert '(unknown)' == dotfile.state - assert True == dotfile.invalid() + assert Dotfile.states['ok'] == dotfile.state + assert True == dotfile.is_ok() - dotfile.state = '(ok)' - assert False == dotfile.invalid() + dotfile.state = Dotfile.states['conflict'] + assert False == dotfile.is_ok() |