Esempio n. 1
0
def test_output_text_diagnostic(reset_results_dictionary):
    """Set the report and check the textual output."""
    report.set_result("Command executes", False, "Missing trailing slash")
    output = report.output(report.get_result(), report.TEXT)
    assert "Command executes" in output
    assert "Missing trailing slash" in output
    assert "\n" in output
Esempio n. 2
0
def test_set_result(reset_results_dictionary):
    """Set the result dictionary and check if it keeps the values."""
    report.set_result("Command executes", True, "")
    assert report.get_result()[
        constants.results.Description] == "Command executes"
    assert report.get_result()[constants.results.Outcome] is True
    assert report.get_result()[constants.results.Diagnostic] == ""
Esempio n. 3
0
def report_result(status, message, diagnostic):
    """Set the report after running a check."""
    if status:
        # passed the check, so do not produce a diagnostic message
        report.set_result(message, status, constants.markers.No_Diagnostic)
    else:
        # did not pass the check, so produce a diagnostic message
        report.set_result(message, status, diagnostic)
Esempio n. 4
0
def report_result(status, message, diagnostic):
    """Set the report after running a check"""
    if status:
        # passed the check, so do not produce a diagnostic message
        report.set_result(message, status, NO_DIAGNOSTIC)
    else:
        # did not pass the check, so produce a diagnostic message
        report.set_result(message, status, diagnostic)
Esempio n. 5
0
def test_output_json(reset_results_dictionary):
    """Set the report and check output as JSON-based text."""
    report.set_result("Command executes", True, "")
    output = report.output(report.get_result(), report.JSON)
    assert output is not None
    assert "\n" not in output
    assert "Command executes" in output
    assert "true" in output
    assert f'"{constants.results.Check}":' in output
    assert f'"{constants.results.Outcome}":' in output
    assert f'"{constants.results.Diagnostic}":' in output
Esempio n. 6
0
def test_output_json(reset_results_dictionary):
    """Set the report and check output as JSON-based text"""
    report.set_result("Command executes", True, "")
    output = report.output(report.get_result(), report.JSON)
    assert output is not None
    assert "\n" not in output
    assert "Command executes" in output
    assert "true" in output
    assert f'"{report.CHECK}":' in output
    assert f'"{report.OUTCOME}":' in output
    assert f'"{report.DIAGNOSTIC}":' in output
Esempio n. 7
0
def test_set_result_return(reset_results_dictionary):
    """Set the result dictionary and check if it keeps the values."""
    new_result = report.set_result("Command executes", False,
                                   "Missing trailing slash")
    assert new_result[constants.results.Check] == "Command executes"
    assert new_result[constants.results.Outcome] is False
    assert new_result[constants.results.Diagnostic] == "Missing trailing slash"
Esempio n. 8
0
def test_set_result_return(reset_results_dictionary):
    """Set the result dictionary and check if it keeps the values"""
    new_result = report.set_result("Command executes", False,
                                   "Missing trailing slash")
    assert new_result[report.CHECK] == "Command executes"
    assert new_result[report.OUTCOME] is False
    assert new_result[report.DIAGNOSTIC] == "Missing trailing slash"
Esempio n. 9
0
def test_output_text(reset_results_dictionary):
    """Set the report and check the textual output."""
    report.set_result("Command executes", True, "")
    output = report.output(report.get_result(), report.TEXT)
    assert "Command executes" in output
    assert "\n" not in output
Esempio n. 10
0
def test_set_result(reset_results_dictionary):
    """Set the result dictionary and check if it keeps the values"""
    report.set_result("Command executes", True, "")
    assert report.get_result()[report.CHECK] == "Command executes"
    assert report.get_result()[report.OUTCOME] is True
    assert report.get_result()[report.DIAGNOSTIC] == ""