aboutsummaryrefslogtreecommitdiffstats
path: root/test_dotfiles.py
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-03 22:37:49 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2016-01-03 22:39:43 -0500
commitf216646d2e824af726a7cd0d4d881577ea6dd0d8 (patch)
treefc62ea1b9b547b918011543cf0a5f79404ad2f94 /test_dotfiles.py
parentad3e6a6d4456ffdf4c26deac7e06aa35d487f92e (diff)
downloaddotfiles-f216646d2e824af726a7cd0d4d881577ea6dd0d8.tar.gz
dotfiles-f216646d2e824af726a7cd0d4d881577ea6dd0d8.tar.bz2
dotfiles-f216646d2e824af726a7cd0d4d881577ea6dd0d8.zip
Add cli tests
Diffstat (limited to 'test_dotfiles.py')
-rw-r--r--test_dotfiles.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/test_dotfiles.py b/test_dotfiles.py
index cea1446..371b66e 100644
--- a/test_dotfiles.py
+++ b/test_dotfiles.py
@@ -1,6 +1,7 @@
import py
import pytest
+from dotfiles import __version__
from dotfiles import cli, unique_suffix
from dotfiles import Repository, Dotfile
@@ -29,6 +30,41 @@ class TestCli(object):
assert not result.exception
assert result.output == '[no dotfiles found]\n'
+ def test_list(self, runner, repo, home):
+ repo.ensure('foo')
+ repo.ensure('bar')
+ repo.ensure('baz')
+ result = runner.invoke(cli, ['--home-directory', str(home),
+ '--repository', str(repo),
+ 'list'])
+ assert not result.exception
+ assert result.output == ('.bar\n'
+ '.baz\n'
+ '.foo\n')
+
+ def test_list_verbose(self, runner, repo, home):
+ repo.ensure('baz')
+ repo.ensure('foo')
+ home.ensure('.foo')
+ home.join('.bar').mksymlinkto(repo.ensure('bar'))
+
+ result = runner.invoke(cli, ['--home-directory', str(home),
+ '--repository', str(repo),
+ 'list', '--verbose'])
+ assert not result.exception
+ assert result.output == (
+ '.bar (ok)\n'
+ '.baz (missing)\n'
+ '.foo (conflict)\n')
+
+ def test_staus(self):
+ pass
+
+ def test_version(self, runner):
+ result = runner.invoke(cli, ['version'])
+ assert not result.exception
+ assert result.output == 'dotfiles version %s\n' % __version__
+
class TestRepository(object):