You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/units/cli/galaxy/test_display_header.py

41 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Copyright (c) 2020 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import annotations
from ansible.cli.galaxy import _display_header
def test_display_header_default(capsys):
_display_header('/collections/path', 'h1', 'h2')
out, err = capsys.readouterr()
out_lines = out.splitlines()
assert out_lines[0] == ''
assert out_lines[1] == '# /collections/path'
assert out_lines[2] == 'h1 h2 '
assert out_lines[3] == '---------- -------'
def test_display_header_widths(capsys):
_display_header('/collections/path', 'Collection', 'Version', 18, 18)
out, err = capsys.readouterr()
out_lines = out.splitlines()
assert out_lines[0] == ''
assert out_lines[1] == '# /collections/path'
assert out_lines[2] == 'Collection Version '
assert out_lines[3] == '------------------ ------------------'
def test_display_header_small_widths(capsys):
_display_header('/collections/path', 'Col', 'Ver', 1, 1)
out, err = capsys.readouterr()
out_lines = out.splitlines()
assert out_lines[0] == ''
assert out_lines[1] == '# /collections/path'
assert out_lines[2] == 'Col Ver'
assert out_lines[3] == '--- ---'