Skip to content

Commit a5f4da2

Browse files
committed
Test cookiecutter() with normal input + extra_context.
1 parent 3fcf3bc commit a5f4da2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_main.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,24 @@ def test_cookiecutter_local_with_input(self):
8888
self.assertTrue(os.path.isfile('fake-project/README.rst'))
8989
self.assertFalse(os.path.exists('fake-project/json/'))
9090

91+
@patch(input_str, lambda x: '\n')
92+
def test_cookiecutter_input_extra_context(self):
93+
""" `Call cookiecutter()` with `no_input=False` and `extra_context` """
94+
if not PY3:
95+
sys.stdin = StringIO("\n\n\n\n\n\n\n\n\n\n\n\n")
96+
97+
main.cookiecutter(
98+
'tests/fake-repo-pre',
99+
no_input=True,
100+
extra_context={'repo_name': 'fake-project-input-extra'}
101+
)
102+
self.assertTrue(os.path.isdir('fake-project-input-extra'))
103+
91104
def tearDown(self):
92105
if os.path.isdir('fake-project'):
93106
utils.rmtree('fake-project')
107+
if os.path.isdir('fake-project-input-extra'):
108+
utils.rmtree('fake-project-input-extra')
94109

95110

96111
class TestArgParsing(unittest.TestCase):

0 commit comments

Comments
 (0)