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
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] == ""
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)
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)
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
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
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"
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"
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
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] == ""