Skip to content
Snippets Groups Projects
Commit b947efe3 authored by gpotter2's avatar gpotter2
Browse files

Tiny fix in mock_windows.uts test

parent 6a783f4a
No related branches found
No related tags found
No related merge requests found
...@@ -206,21 +206,23 @@ import mock ...@@ -206,21 +206,23 @@ import mock
from scapy.config import conf from scapy.config import conf
ps_ip = get_ip_from_name(conf.iface.name) ps_ip = get_ip_from_name(conf.iface.name)
ps_ip
ps_if_list = get_windows_if_list() ps_if_list = get_windows_if_list()
ps_if_list
ps_read_routes = read_routes() ps_read_routes = read_routes()
ps_read_routes
# Turn on VBS mode # Turn on VBS mode
conf.prog.powershell = None conf.prog.powershell = None
= Test get_ip_from_name with VBS = Test get_ip_from_name with VBS
ps_ip
assert get_ip_from_name(conf.iface.name) == ps_ip assert get_ip_from_name(conf.iface.name) == ps_ip
= Test get_windows_if_list with VBS = Test get_windows_if_list with VBS
ps_if_list
def is_in_if_list(i, list): def is_in_if_list(i, list):
if not i["mac"]:
return True
for j in list: for j in list:
if j["guid"] == i["guid"] and j["name"] == i["name"]: if j["guid"] == i["guid"] and j["name"] == i["name"]:
return True return True
...@@ -229,20 +231,23 @@ def is_in_if_list(i, list): ...@@ -229,20 +231,23 @@ def is_in_if_list(i, list):
vbs_if_list = get_windows_if_list() vbs_if_list = get_windows_if_list()
vbs_if_list vbs_if_list
_correct = True _correct = True
for i in ps_if_list: for i in vbs_if_list:
if not is_in_if_list(i, vbs_if_list): if not is_in_if_list(i, ps_if_list):
_correct = False _correct = False
break break
assert _correct assert _correct
= Test read_routes with VBS = Test read_routes with VBS
ps_read_routes
def is_in_route_list(i, list): def is_in_route_list(i, list):
# Ignore all empty IP or macs
if i[4] == '':
return True
if i[3].mac == '' or i[3].guid == '' or i[3].ip == '':
return True
for j in list: for j in list:
#Ignore all empty IP
if j[4] == '' or i[4] == '':
return True
if j[2] == i[2] and j[4] == i[4] and j[3].guid == i[3].guid: if j[2] == i[2] and j[4] == i[4] and j[3].guid == i[3].guid:
return True return True
return False return False
...@@ -250,8 +255,8 @@ def is_in_route_list(i, list): ...@@ -250,8 +255,8 @@ def is_in_route_list(i, list):
vbs_read_routes = read_routes() vbs_read_routes = read_routes()
vbs_if_list vbs_if_list
_correct = True _correct = True
for i in ps_read_routes: for i in vbs_read_routes:
if not is_in_route_list(i, vbs_read_routes): if not is_in_route_list(i, ps_read_routes):
_correct = False _correct = False
break break
......
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