def test_print_heading_3(self, click): ConsolePrinter.print_heading( 'Amet consectetur', ConsolePrinter.HEADING_LEVEL_THREE) assert click.secho.call_count == 2 click.secho.assert_has_calls([ call('Amet consectetur', bold=True, fg=None), call('----------------', bold=True, fg=None), ]) click.echo.assert_called_once_with()
def test_print_heading_2(self, click): ConsolePrinter.print_heading( 'Dolor sic', ConsolePrinter.HEADING_LEVEL_TWO) assert click.secho.call_count == 3 click.secho.assert_has_calls([ call('---------', bold=True, fg=None), call('Dolor sic', bold=True, fg=None), call('---------', bold=True, fg=None), ]) click.echo.assert_called_once_with()
def test_print_heading_1(self, click, style, expected_color): ConsolePrinter.print_heading( 'Lorem ipsum', ConsolePrinter.HEADING_LEVEL_ONE, style) assert click.secho.call_count == 3 click.secho.assert_has_calls([ call('===========', bold=True, fg=expected_color), call('Lorem ipsum', bold=True, fg=expected_color), call('===========', bold=True, fg=expected_color), ]) click.echo.assert_called_once_with()
def test_print_contract_one_liner(self, click, is_kept, whitelisted_path_length, expected_label, expected_color): contract = MagicMock( whitelisted_paths=[MagicMock()] * whitelisted_path_length, is_kept=is_kept, ) contract.__str__.return_value = 'Foo' ConsolePrinter.print_contract_one_liner(contract) if whitelisted_path_length: click.secho.assert_has_calls([ call('Foo ', nl=False), call('({} whitelisted paths) '.format(whitelisted_path_length), nl=False), call(expected_label, fg=expected_color, bold=True) ]) else: click.secho.assert_has_calls([ call('Foo ', nl=False), call(expected_label, fg=expected_color, bold=True) ])
def test_new_line(self, click): ConsolePrinter.new_line() click.echo.assert_called_once_with()
def test_indent_cursor(self, click): ConsolePrinter.indent_cursor() click.echo.assert_called_once_with(' ', nl=False)
def test_print_error(self, click, bold): ConsolePrinter.print_error(sentinel.text, bold) click.secho.assert_called_once_with( sentinel.text, fg='red', bold=bold)
def test_print_success(self, click, bold): ConsolePrinter.print_success(sentinel.text, bold) click.secho.assert_called_once_with( sentinel.text, fg='green', bold=bold)