コード例 #1
0
def test_resolve_template_name(tmpdir):
    """ test resolving template names from plonecli alias
    """
    plonecli_alias = 'addon'
    reg = TemplateRegistry()
    template_name = reg.resolve_template_name(plonecli_alias)
    assert 'bobtemplates.plone:addon' == template_name
コード例 #2
0
def test_list_templates(tmpdir):
    os.chdir(tmpdir.strpath)
    reg = TemplateRegistry()
    template_str = reg.list_templates()
    assert '- buildout' in template_str
    assert '- addon' in template_str
    assert '- theme' in template_str
    assert '- content_type' in template_str
コード例 #3
0
def test_get_templates(tmpdir):
    """ test get_templates outside of a package
    """
    os.chdir(tmpdir.strpath)
    reg = TemplateRegistry()
    templates = reg.get_templates()
    assert 'addon' in templates
    assert 'theme_package' in templates
    assert 'buildout' in templates
コード例 #4
0
def test_get_subtemplates(tmpdir):
    """ test get_templates inside of a package
    """
    template = """[check-manifest]
check=True

[tool:bobtemplates.plone]
template=plone_addon
"""
    target_dir = tmpdir.strpath + '/collective.foo'
    os.mkdir(target_dir)
    with open(os.path.join(target_dir + '/setup.cfg'), 'w') as f:
        f.write(template)
    os.chdir(target_dir)
    reg = TemplateRegistry()
    templates = reg.get_templates()
    assert 'content_type' in templates
    assert 'theme' in templates
    assert 'vocabulary' in templates
コード例 #5
0
def test_bob_config(tmpdir):
    target_dir = tmpdir.strpath + '/collective.foo'
    os.mkdir(target_dir)
    os.chdir(target_dir)
    template = """[main]
template=plone_addon
version=5.1-latest
python=python2.7
"""
    with open(os.path.join(target_dir + '/bobtemplate.cfg'), 'w') as f:
        f.write(template)
    reg = TemplateRegistry()
    bob_config = read_bob_config(reg.root_folder)
    assert bob_config.python == 'python2.7'