21 lines
605 B
Python
21 lines
605 B
Python
from magicli.magicli import help_message
|
|
from unittest import mock
|
|
|
|
|
|
def get_terminal_size():
|
|
return (80, 20)
|
|
|
|
def test_minimal_example():
|
|
config = {
|
|
'name': '',
|
|
'function': {'docstring': ''},
|
|
'arguments': {'argument': []},
|
|
'options': {},
|
|
'commands': {},
|
|
'settings': {'display_arguments_more_than': 0},
|
|
}
|
|
with mock.patch('os.get_terminal_size', get_terminal_size):
|
|
assert isinstance(help_message(config), str)
|
|
assert help_message(config).startswith('Usage:')
|
|
assert help_message(config).rstrip().endswith('argument')
|