コード例 #1
0
def test_valid_handles_domain_and_subdomain(get_valid_handles_domain_subdomain,
                                            capfd) -> None:
    """
    Test if a valid combination of domain and subdomain produces correct ouput
    """
    for valid_domain_subdomain in get_valid_handles_domain_subdomain:
        template_info = TemplateInfo()
        template_info.show_info(valid_domain_subdomain)
        out, err = capfd.readouterr()

        # first entry of value list are expected handles present in output second are the ones that should not be in output
        switcher: Dict[str, list] = {
            'cli-python': [['cli-python'], 'cli-java'],
            'cli-java': [['cli-java'], 'cli-python'],
            'gui-java': [['gui-java']],
            'web-website': [['web-website'], ['']],
            'web-website-python': [['web-website-python'], ['']],
            'pub-thesis': [['pub-thesis'], ['']],
            'pub-thesis-latex': [['pub-thesis-latex'], ['']]
        }

        for exp_handle in switcher[valid_domain_subdomain][0]:
            assert exp_handle in out and not any(
                not_exp_handle in out
                for not_exp_handle in switcher[valid_domain_subdomain][1]
                if not_exp_handle)
コード例 #2
0
def info(ctx, handle: str) -> None:
    """
    Get detailed info on a cookietemple template domain or a single template.

    list only provides an overview of all templates.
    Info provides a long description for a specific subset of templates.
    Pass a domain, language or full handle (e.g. cli-python).
    """
    if not handle:
        HelpErrorHandling.args_not_provided(ctx, 'info')
    else:
        template_info = TemplateInfo()
        template_info.show_info(handle.lower())
コード例 #3
0
def test_valid_handles_domain_only(get_valid_handles_domain_only,
                                   capfd) -> None:
    """
    Ensure that valid handles will be displayed properly by the info command.
    """
    switcher = {
        'cli': ('cli-python', 'cli-java'),
        'web': 'web-website-python',
        'gui': 'gui-java',
        'pub': 'pub-thesis-latex'
    }

    for valid_domain in get_valid_handles_domain_only:
        template_info = TemplateInfo()
        template_info.show_info(valid_domain)
        out, err = capfd.readouterr()

        for handle in switcher[valid_domain]:
            assert handle in out
コード例 #4
0
def test_valid_handles_domain_only(get_valid_handles_domain_only,
                                   capfd) -> None:
    """
    Ensure that valid handles will be displayed properly by the info command.
    """
    switcher = {
        "cli": ("cli-python", "cli-java"),
        "web": "web-website-python",
        "gui": "gui-java",
        "pub": "pub-thesis-latex",
    }

    for valid_domain in get_valid_handles_domain_only:
        template_info = TemplateInfo()
        template_info.show_info(valid_domain)
        out, err = capfd.readouterr()

        for handle in switcher[valid_domain]:
            assert handle in out