# Path: poet/utils/helpers.py
# def template(name):
#     """
#     Returns a template given a name.
#     
#     :param name: The name of the template.
#     :type name: str
#     
#     :rtype: jinja2.Template 
#     """
#     if not name.endswith('.jinja2'):
#         name += '.jinja2'
# 
#     return TEMPLATE_ENV.get_template(name)


import os
from cleo import CommandTester
from poet.utils.helpers import template
        'MIT',  # License
        'n',  # Interactive packages
        'n',  # Interactive dev packages
        '\n'  # Generate
    ])
    tester.execute([('command', command.name)])

    output = tester.get_display()
    expected = template('poetry.toml').render(
        name='my-package',
        version='0.1.0',
        description='This is a description',
        authors=[],
        license='MIT'
    )

    assert expected in output
    assert os.path.exists(os.path.join(tmp_dir, 'poetry.toml'))
    check_output.assert_called_once()


def test_default_template(app, mocker, tmp_dir):
    getcwd = mocker.patch('os.getcwd')
    getcwd.return_value = tmp_dir

    command = app.find('init')
    tester = CommandTester(command)
    tester.execute([('command', command.name), ('template', 'default')])

    output = tester.get_display()

# Path: poet/utils/helpers.py
# def template(name):
#     """
#     Returns a template given a name.
#     
#     :param name: The name of the template.
#     :type name: str
#     
#     :rtype: jinja2.Template 
#     """
#     if not name.endswith('.jinja2'):
#         name += '.jinja2'
# 
#     return TEMPLATE_ENV.get_template(name)


# Path: tests/commands/test_init.py
import os
from cleo import CommandTester
from poet.utils.helpers import template

        'MIT',  # License
        'n',  # Interactive packages
        'n',  # Interactive dev packages
        '\n'  # Generate
    ])
    tester.execute([('command', command.name)])

    output = tester.get_display()
    expected = template('poetry.toml').render(
        name='my-package',
        version='0.1.0',
        description='This is a description',
        authors=[],
        license='MIT'
    )

    assert expected in output
    assert os.path.exists(os.path.join(tmp_dir, 'poetry.toml'))
    check_output.assert_called_once()


def test_default_template(app, mocker, tmp_dir):
    getcwd = mocker.patch('os.getcwd')
    getcwd.return_value = tmp_dir

    command = app.find('init')
    tester = CommandTester(command)
    tester.execute([('command', command.name), ('template', 'default')])

    output = tester.get_display()

    content = template('poetry.toml').render()