|
|
|
@ -56,28 +56,38 @@ def authorized_as_hub(headers):
|
|
|
|
|
def my_exec_info_message(exec_info):
|
|
|
|
|
return "{}: {}".format(".".join([exec_info[0].__module__, exec_info[0].__name__]), exec_info[1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mylog_current_test_id_container = {
|
|
|
|
|
'value': '',
|
|
|
|
|
}
|
|
|
|
|
def set_mylog_test_id(test_id):
|
|
|
|
|
mylog_current_test_id_container['value'] = ".".join(test_id.split(".")[-2:])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def log_output_for_tests(app: Flask, message: str):
|
|
|
|
|
if app.config['TESTING'] != False:
|
|
|
|
|
if app.config['TESTING'] and mylog_current_test_id_container['value'] != "":
|
|
|
|
|
file_object = open('unittest-log-output.log', 'a')
|
|
|
|
|
file_object.write(message)
|
|
|
|
|
file_object.write(f"{mylog_current_test_id_container['value']}: {message}\n")
|
|
|
|
|
file_object.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def mylog_debug(app: Flask, message: str):
|
|
|
|
|
log_output_for_tests(app, f"DEBUG: {message}\n")
|
|
|
|
|
log_output_for_tests(app, f"DEBUG: {message}")
|
|
|
|
|
app.logger.debug(message)
|
|
|
|
|
|
|
|
|
|
def mylog_info(app: Flask, message: str):
|
|
|
|
|
log_output_for_tests(app, f"INFO: {message}\n")
|
|
|
|
|
log_output_for_tests(app, f"INFO: {message}")
|
|
|
|
|
app.logger.info(message)
|
|
|
|
|
|
|
|
|
|
def mylog_warning(app: Flask, message: str):
|
|
|
|
|
log_output_for_tests(app, f"WARNING: {message}\n")
|
|
|
|
|
log_output_for_tests(app, f"WARNING: {message}")
|
|
|
|
|
app.logger.warning(message)
|
|
|
|
|
|
|
|
|
|
def mylog_error(app: Flask, message: str):
|
|
|
|
|
log_output_for_tests(app, f"ERROR: {message}\n")
|
|
|
|
|
log_output_for_tests(app, f"ERROR: {message}")
|
|
|
|
|
app.logger.error(message)
|
|
|
|
|
|
|
|
|
|
def mylog_critical(app: Flask, message: str):
|
|
|
|
|
log_output_for_tests(app, f"CRITICAL: {message}\n")
|
|
|
|
|
log_output_for_tests(app, f"CRITICAL: {message}")
|
|
|
|
|
app.logger.critical(message)
|