Skip to content
Snippets Groups Projects
Commit a529f76e authored by alexey.stratulat's avatar alexey.stratulat
Browse files

I brought the file with the main_test test in order. Now main_test.py returns...

I brought the file with the main_test test in order. Now main_test.py returns the final code, creates a configuration file as in libdap, so that the test passes, replaces all print with logIt.
parent f871301b
No related branches found
No related tags found
1 merge request!26Support 3689
import libdapConnector import libdapConnector
import os
import sys
def output_info(string):
libdapConnector.logIt(libdapConnector.LogLevel.L_INFO, string)
def output_info_failed(string):
libdapConnector.logIt(libdapConnector.LogLevel.L_CRITICAL, string)
def create_config_file(app_name):
f = open(app_name+".cfg", "w")
f.write("[server]\nlisten_address=0.0.0.0\n")
f.close()
output_info("Start main test")
app_name = "TestAPP"
output_info("Create config file")
create_config_file(app_name)
json_string = """{ json_string = """{
"modules": "libdap", "modules": "libdap",
"dap": { "dap": {
"config_dir": "/opt/dap/etc", "config_dir": \""""+os.getcwd()+"""\",
"log_level": \""""+libdapConnector.LogLevel.L_DEBUG.name+"""\", "log_level": \""""+libdapConnector.LogLevel.L_DEBUG.name+"""\",
"application_name": "TestAPP" "application_name": \""""+app_name+"""\"
} }
}""" }"""
print("Standard Configuration \n"+json_string)
libdapConnector.init(json_string) libdapConnector.init(json_string)
print("Initialization of the DAP") output_info("Initialization of the DAP done")
libdapConnector.setLogLevel(libdapConnector.LogLevel.L_DEBUG) libdapConnector.setLogLevel(libdapConnector.LogLevel.L_DEBUG)
print("Level logging ""DEBUG"" done") output_info("Level logging ""DEBUG"" done")
libdapConnector.logIt(libdapConnector.LogLevel.L_DEBUG, "Test. Outputting a string using the log_it function in the libdap library") libdapConnector.logIt(libdapConnector.LogLevel.L_DEBUG, "Test. Outputting a string using the log_it function in the libdap library")
print("Outputting a string using the log_it function done") output_info("Outputting a string using the log_it function done")
res1 = libdapConnector.configGetItem("server", "listen_address") res1 = libdapConnector.configGetItem("server", "listen_address")
print("Output [server] 'listen_address' = "+res1+"\n") output_info("Output [server] 'listen_address' = "+res1+"\n")
res2 = libdapConnector.configGetItemDefault("server1", "listen_address", "8.8.8.8") res2 = libdapConnector.configGetItemDefault("server1", "listen_address", "8.8.8.8")
print("Output default value '8.8.8.8' \n [server1] 'listen_address' = "+res2+"\n") output_info("Output default value '8.8.8.8' \n [server1] 'listen_address' = "+res2+"\n")
print("TEST. Get default config done") output_info("TEST. Get default config done")
libdapConnector.deInit() libdapConnector.deInit()
print("Deinitialization done") output_info("Deinitialization done")
os.remove(app_name+".cfg")
output_info("Dellete config file")
output_info("Main test done");
sys.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment