From 9a1f55e0bad71d036bd9bce8a7d315935d674b9d Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Mon, 27 Aug 2018 11:41:57 -0400 Subject: Add tests for Repository constructor parameters --- tests/test_repository.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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') -- cgit v1.2.3