Exemplo n.º 1
0
def test_pretty_results(fake_results):
    """Ensure pretty results is calling everything it should."""

    with patch.object(formatting, "pretty_header") as patched_header:
        with patch.object(formatting, "_pretty_result") as patched_result:
            with patch.object(formatting, "write") as patched_write:
                formatting.pretty_results(fake_results)

    assert patched_header.called
    assert patched_result.called
    assert patched_write.called
Exemplo n.º 2
0
def test_pretty_results(fake_results):
    """Ensure pretty results is calling everything it should."""

    with patch.object(formatting, "pretty_header") as patched_header:
        with patch.object(formatting, "_pretty_result") as patched_result:
            with patch.object(formatting, "write") as patched_write:
                formatting.pretty_results(fake_results)

    assert patched_header.called
    assert patched_result.called
    assert patched_write.called
Exemplo n.º 3
0
def cmdline_exit(results, options):
    """A buffer for selecting the correct output function and exiting.

    Args::

        results: the results dictionary from Bladerunner.run
        options: the options dictionary, uses 'style' and 'stacked' keys
    """

    if options.get("stacked"):
        stacked_results(results, options)
    elif options["style"] < 0 or options["style"] > 3:
        csv_results(results, options)
    else:
        pretty_results(results, options)

    raise SystemExit
Exemplo n.º 4
0
def cmdline_exit(results, options):
    """A buffer for selecting the correct output function and exiting.

    Args::

        results: the results dictionary from Bladerunner.run
        options: the options dictionary, uses 'style' key only
    """

    if options["style"] < 0 or options["style"] > 3:
        csv_results(results, options)
    else:
        try:
            pretty_results(results, options)
        except UnicodeEncodeError:
            csv_results(results, options)
    raise SystemExit
Exemplo n.º 5
0
def cmdline_exit(results, options):
    """A buffer for selecting the correct output function and exiting.

    Args::

        results: the results dictionary from Bladerunner.run
        options: the options dictionary, uses 'style' and 'stacked' keys
    """

    if options.get("stacked"):
        stacked_results(results, options)
    elif options["style"] < 0 or options["style"] > 3:
        csv_results(results, options)
    else:
        pretty_results(results, options)

    raise SystemExit