aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@jbernard.io> 2018-08-27 11:41:57 -0400
committerGravatar Jon Bernard <jbernard@jbernard.io> 2018-08-27 11:41:57 -0400
commit9a1f55e0bad71d036bd9bce8a7d315935d674b9d (patch)
tree47f4b105e2ec0df521c18215516cb345936faa9a /tests
parent45c191e2d01ee5ee27467bd5399f1d38cc76e665 (diff)
downloaddotfiles-9a1f55e0bad71d036bd9bce8a7d315935d674b9d.tar.gz
dotfiles-9a1f55e0bad71d036bd9bce8a7d315935d674b9d.tar.bz2
dotfiles-9a1f55e0bad71d036bd9bce8a7d315935d674b9d.zip
Add tests for Repository constructor parameters
Diffstat (limited to 'tests')
-rw-r--r--tests/test_repository.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_repository.py b/tests/test_repository.py
index 58e6cf9..60ae8e3 100644
--- a/tests/test_repository.py
+++ b/tests/test_repository.py
@@ -1,7 +1,8 @@
import pytest
import py.path
-from dotfiles.repository import Repository
+from dotfiles.repository import Repository, \
+ DEFAULT_REMOVE_LEADING_DOT, DEFAULT_IGNORE_PATTERNS
from dotfiles.exceptions import NotRootedInHome, InRepository, TargetIgnored, \
IsDirectory
@@ -13,6 +14,22 @@ def test_repo_create(repo):
assert repo.path.check(exists=1, dir=1)
+@pytest.mark.parametrize('remove_leading_dot',
+ [DEFAULT_REMOVE_LEADING_DOT,
+ not DEFAULT_REMOVE_LEADING_DOT])
+@pytest.mark.parametrize('ignore_patterns', [DEFAULT_IGNORE_PATTERNS,
+ ['foo', 'bar', 'baz']])
+def test_repo_params(repo, remove_leading_dot, ignore_patterns):
+ _repo = Repository(repo.path,
+ remove_leading_dot=remove_leading_dot,
+ ignore_patterns=ignore_patterns,
+ homedir=repo.homedir)
+ assert _repo.path == repo.path
+ assert _repo.homedir == repo.homedir
+ assert _repo.remove_leading_dot == remove_leading_dot
+ assert _repo.ignore_patterns == ignore_patterns
+
+
def test_str(repo):
repo.path.ensure('a')
repo.path.ensure('b')