Skip to content

Commit

Permalink
Some tests and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dokempf committed Dec 18, 2020
1 parent 05c989f commit caa90cb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ covers some additional aspects that are important for my work:

* Up to date with later versions of cookiecutter
* Automatically adds license selection to the generated cookiecutter
* Slightly different set of configuration values tuned to my needs
* Optionally generates cookiecutters that perform a Git repository setup

# Prerequisites

Meta-cookiecutter only requires [cookiecutter](https://github.com/cookiecutter/cookiecutter) itself, which can be installed with:
Expand Down
41 changes: 38 additions & 3 deletions tests/test_bake_project.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
import pytest

from . import check_bake, inside_bake


def test_project_tree(cookies):
bake = cookies.bake(extra_context={'project_slug': 'test_project'})
def bake_outer_inner(cookies, outer_context={}, inner_context={}):
# Configure a cookiecutter
bake = cookies.bake(extra_context=outer_context)
check_bake(bake)

# Now try to configure a project from the generated cookiecutter
with inside_bake(bake):
inner = cookies.bake(extra_context={'project_slug': 'inner_project'})
inner = cookies.bake(extra_context=inner_context)
check_bake(inner)


def test_nogit(cookies):
bake_outer_inner(
cookies,
outer_context={
'git_setup': 'No',
}
)


@pytest.mark.parametrize(
"remote_url",
[
"None",
"[email protected]:dokempf/test-repo.git",
"https://github.com/dokempf/test-github-actions-cookiecutter-cpp-project.git",
"[email protected]:dokempf/test-repo.git",
"https://gitlab.com/dokempf/test-repo.git",
"ssh://[email protected]:22022/dominic/test-repo.git",
"https://gitlab.dune-project.org/dominic/test-repo.git"
])
def test_git(cookies, remote_url):
bake_outer_inner(
cookies,
inner_context={
'remote_url': remote_url,
},
outer_context={
'git_setup': 'No',
}
)

0 comments on commit caa90cb

Please sign in to comment.