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_repository.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_repository.py')
-rw-r--r-- | tests/test_repository.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/tests/test_repository.py b/tests/test_repository.py index 8e6b48b..c8212e6 100644 --- a/tests/test_repository.py +++ b/tests/test_repository.py @@ -65,8 +65,8 @@ def test_empty_status(tmpdir): def test_status_manual(tmpdir, monkeypatch): repodir = tmpdir.join("Dotfiles", dir=1) - name = tmpdir.join(".vimrc") target = repodir.ensure("vimrc") + name = tmpdir.ensure(".vimrc") dotfile = Dotfile(name, target) @@ -74,9 +74,10 @@ def test_status_manual(tmpdir, monkeypatch): monkeypatch.setattr(Repository, "_load", lambda self: [dotfile, dotfile, dotfile]) - expected_status = (".vimrc -> Dotfiles/vimrc (unknown)\n" - ".vimrc -> Dotfiles/vimrc (unknown)\n" - ".vimrc -> Dotfiles/vimrc (unknown)") + dotfile_state = Dotfile.states['conflict']['text'] + expected_status = ("{0:<18} {1}\n" + "{0:<18} {1}\n" + "{0:<18} {1}".format(name.basename, dotfile_state)) assert expected_status == repo.status() @@ -91,9 +92,12 @@ def test_status_discover(tmpdir): repo = Repository(repodir, tmpdir) - expected_status = (".bashrc -> Dotfiles/bashrc (unknown)\n" - ".inputrc -> Dotfiles/inputrc (unknown)\n" - ".vimrc -> Dotfiles/vimrc (unknown)") + expected_status = ("{1:<18} {0}\n" + "{2:<18} {0}\n" + "{3:<18} {0}".format(Dotfile.states['ok']['text'], + '.bashrc', + '.inputrc', + '.vimrc')) assert expected_status == repo.status() @@ -106,14 +110,18 @@ def test_check(tmpdir, monkeypatch): dotfile_b = Dotfile(tmpdir.join('.bbb'), repodir.join('bbb')) dotfile_c = Dotfile(tmpdir.join('.ccc'), repodir.join('ccc')) - dotfile_b.state = '(ok)' + dotfile_b.state = Dotfile.states['ok'] repo = Repository(tmpdir) monkeypatch.setattr(Repository, "_load", lambda self: [dotfile_a, dotfile_b, dotfile_c]) - assert ('.aaa -> repo/aaa (unknown)\n' - '.ccc -> repo/ccc (unknown)') == repo.check() + expected_status = ("{1:<18} {0}\n" + "{2:<18} {0}".format(Dotfile.states['error']['text'], + dotfile_a.name.basename, + dotfile_c.name.basename)) + + assert expected_status == repo.check() def test_sync(): |