mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 11:18:03 +00:00
sta_connect_example.py: shows example of how to get passing state and failure messages
This commit is contained in:
@@ -3,17 +3,17 @@
|
||||
# Example of how to instantiate StaConnect and run the test
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
if 'py-json' not in sys.path:
|
||||
sys.path.append('../py-json')
|
||||
|
||||
from LANforge.LFUtils import *
|
||||
# if you lack __init__.py in this directory you will not find sta_connect module
|
||||
import sta_connect
|
||||
from sta_connect import StaConnect
|
||||
|
||||
|
||||
def main():
|
||||
staConnect = StaConnect("localhost", 8080)
|
||||
staConnect.sta_mode = 0
|
||||
@@ -24,9 +24,15 @@ def main():
|
||||
staConnect.dut_ssid = "jedway-wpa2-x2048-5-1"
|
||||
staConnect.dut_passwd = "jedway-wpa2-x2048-5-1"
|
||||
staConnect.run()
|
||||
run_results = staConnect.get_result_list()
|
||||
for result in run_results:
|
||||
print("test result: "+result)
|
||||
is_passing = staConnect.passes()
|
||||
if is_passing == False:
|
||||
# run_results = staConnect.get_failed_result_list()
|
||||
fail_message = staConnect.get_fail_message()
|
||||
print("Some tests failed:\n" + fail_message)
|
||||
else:
|
||||
print("Tests pass")
|
||||
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user