def test_create_incident_from_exception(negative_conn_cnx): with negative_conn_cnx() as con: try: raise ValueError("This is a test") except Exception as e: em = str(e) est = format_exc() incident = Incident(None, None, "unit test", "99.99.99", em, est) new_incident_id = con.incident.report_incident(incident) if new_incident_id is None: warnings.warn( UserWarning("incident reported in 'test_create_incident_from_exception' was ignored"))
def test_default_values(): incident = Incident("ji", "ri", "dr", "dv", "em", "est\n\test2") print(incident) assert (incident.jobId == "ji") assert (incident.requestId == "ri") assert (incident.driver == "dr") assert (incident.driverVersion == "dv") assert (incident.errorMessage == "em") assert (incident.errorStackTrace == "est\n\test2") assert incident.driver assert incident.driverVersion assert incident.os assert incident.osVersion
def test_incident_creation(): error_message = "This is an exception" error_stack_trace = "this is\n\twhat happened" driver = "unit-testing" driver_version = "0.0.0" os = "unit testinux" os_version = "1.0.0" incident = Incident(None, None, driver, driver_version, error_message, error_stack_trace, os, os_version) print(incident) assert (incident.errorMessage == error_message) assert (incident.errorStackTrace == error_stack_trace) assert (incident.driver == driver) assert (incident.driverVersion == driver_version) assert (incident.os == os) assert (incident.osVersion == os_version)