def test_template_list(): args = { 'template': 'test', 'list': True, '--template-repo': project.basedir() } templates = TemplatesCommand(args) with catch_stdout() as caught_output: templates.action() assert caught_output.getvalue() is not None
def test_template_list(valid_template_dir, copy_tree_mock): args = { 'template': 'test', 'list': True, '--template-repo': valid_template_dir } templates = TemplatesCommand(args) with catch_stdout() as caught_output: templates.action() assert caught_output.getvalue() is not None
def test_template_list_invalid_repo_dir(invalid_template_dir, copy_tree_mock): invalid_template_dir = "/tmp/invalid-mlt-dir" args = { 'template': 'test', 'list': True, '--template-repo': invalid_template_dir } if invalid_template_dir.startswith("/tmp/"): if os.path.exists(invalid_template_dir): shutil.rmtree(invalid_template_dir) templates = TemplatesCommand(args) with catch_stdout() as caught_output: templates.action() assert caught_output.getvalue() is not None
def test_template_list(open_mock, valid_template_dir, copy_tree_mock, listdir_mock, os_path_exists_mock, os_path_isfile_mock, sorted_mock): args = { 'template': 'test', 'list': True, '--template-repo': valid_template_dir } os_path_exists_mock.return_value = True os_path_isfile_mock.return_value = True sorted_mock.return_value = ['hello-world', 'tf-dist-mnist'] templates = TemplatesCommand(args) with catch_stdout() as caught_output: templates.action() assert caught_output.getvalue() is not None