autotests: Replace strings with constants

This commit is contained in:
Tim Kourt 2016-06-03 16:13:46 -07:00 committed by Denis Kenzior
parent 2b1e820062
commit 9c8595c43f
1 changed files with 7 additions and 7 deletions

View File

@ -18,13 +18,13 @@ import utility
def getSecondNetworkToConnect(objectList, firstNetworkName): def getSecondNetworkToConnect(objectList, firstNetworkName):
logger.debug(sys._getframe().f_code.co_name) logger.debug(sys._getframe().f_code.co_name)
for path in objectList: for path in objectList:
if 'net.connman.iwd.Device' not in objectList[path]: if utility.IWD_DEVICE_INTERFACE not in objectList[path]:
continue continue
for path2 in objectList: for path2 in objectList:
if not path2.startswith(path) or \ if not path2.startswith(path) or \
'net.connman.iwd.Network' not in objectList[path2]: utility.IWD_NETWORK_INTERFACE not in objectList[path2]:
continue continue
network = objectList[path2]['net.connman.iwd.Network'] network = objectList[path2][utility.IWD_NETWORK_INTERFACE]
for key in network.keys(): for key in network.keys():
if key in ["Name"]: if key in ["Name"]:
# skip the first connected network # skip the first connected network
@ -40,9 +40,9 @@ class TestTwoNetworks(unittest.TestCase):
# start simpleAgent # start simpleAgent
proc = Popen([sys.executable, '../utility/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(utility.IWD_SERVICE,
networkToConnect), networkToConnect),
"net.connman.iwd.Network") utility.IWD_NETWORK_INTERFACE)
status = utility.connect(networkToConnect, self, mainloop, bus) status = utility.connect(networkToConnect, self, mainloop, bus)
if status == False: if status == False:
#terminate proc #terminate proc
@ -95,7 +95,7 @@ class TestTwoNetworks(unittest.TestCase):
def test_twoNetworks(self): def test_twoNetworks(self):
logger.info(sys._getframe().f_code.co_name) logger.info(sys._getframe().f_code.co_name)
while (True): while (True):
if bus.name_has_owner('net.connman.iwd') == True: if bus.name_has_owner(utility.IWD_SERVICE) == True:
break break
self.doConnectDisconnectTwoNetworks() self.doConnectDisconnectTwoNetworks()