mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-20 09:34:06 +01:00
autotests: fixed connectDisconnect after objectManager changes
This commit is contained in:
parent
3c68c358d8
commit
149eff1c71
@ -13,25 +13,10 @@ import sys
|
|||||||
sys.path.append('../utility') #needed to import all the utility modules
|
sys.path.append('../utility') #needed to import all the utility modules
|
||||||
import utility
|
import utility
|
||||||
|
|
||||||
def defineAgentVars():
|
|
||||||
global manager, pathAgent
|
|
||||||
bus = dbus.SystemBus()
|
|
||||||
pathAgent = "/connectToNetwork/agent/" + str(randrange(100))
|
|
||||||
manager = dbus.Interface(bus.get_object('net.connman.iwd', "/"),
|
|
||||||
'net.connman.iwd.Manager')
|
|
||||||
|
|
||||||
def getManager():
|
|
||||||
return manager
|
|
||||||
|
|
||||||
def getPathAgent():
|
|
||||||
return pathAgent
|
|
||||||
|
|
||||||
class TestConnectDisconnect(unittest.TestCase):
|
class TestConnectDisconnect(unittest.TestCase):
|
||||||
def doConnectDisconnect(self):
|
def doConnectDisconnect(self):
|
||||||
deviceList = utility.getDeviceList(bus)
|
objectList = utility.getObjectList(bus)
|
||||||
networkList = utility.getNetworkList(deviceList, bus)
|
networkToConnect = utility.getNetworkToConnectTo(objectList)
|
||||||
utility.printNetworkInfo(networkList)
|
|
||||||
networkToConnect = utility.getNetworkToConnectTo(networkList)
|
|
||||||
|
|
||||||
# check if networkToConnect is not null. If yes, restart program
|
# check if networkToConnect is not null. If yes, restart program
|
||||||
# so that the network list is updated. Alternatively, we can scan
|
# so that the network list is updated. Alternatively, we can scan
|
||||||
@ -43,20 +28,21 @@ class TestConnectDisconnect(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertNotEqual(networkToConnect, "")
|
self.assertNotEqual(networkToConnect, "")
|
||||||
# start simpleAgent
|
# start simpleAgent
|
||||||
proc = Popen([sys.executable, './simpleAgent.py'])
|
proc = Popen([sys.executable, '../utility/simpleAgent.py'])
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
network = dbus.Interface(bus.get_object("net.connman.iwd",
|
network = dbus.Interface(bus.get_object("net.connman.iwd",
|
||||||
networkToConnect),
|
networkToConnect),
|
||||||
"net.connman.iwd.Network")
|
"net.connman.iwd.Network")
|
||||||
status = utility.connect(networkToConnect, self, mainloop, bus)
|
status = utility.connect(networkToConnect, self, mainloop, bus)
|
||||||
|
|
||||||
if status == False:
|
if status == False:
|
||||||
#terminate proc
|
#terminate proc
|
||||||
proc.terminate()
|
proc.terminate()
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.info("Currently connected to: %s",
|
logger.info("Currently connected to: %s",
|
||||||
utility.getCurrentlyConnectedNetworkName())
|
utility.getCurrentlyConnectedNetworkName())
|
||||||
self.assertEqual(utility.getCurrentlyConnectedNetworkName(), "IntelWIFI")
|
self.assertEqual(utility.getCurrentlyConnectedNetworkName(),
|
||||||
|
"IntelWIFI")
|
||||||
|
|
||||||
# retrieve the deviceId form networkToConnect. This will be used
|
# retrieve the deviceId form networkToConnect. This will be used
|
||||||
# for checking if we are disconnecting from the right device later.
|
# for checking if we are disconnecting from the right device later.
|
||||||
|
Loading…
Reference in New Issue
Block a user