From 67a43a081379e3c3fea0ced6f98aa7dccb15adc9 Mon Sep 17 00:00:00 2001 From: Rahul Rahul Date: Mon, 16 May 2016 17:02:33 -0700 Subject: [PATCH] autotests: scan network when no AP is present --- autotests/test0AP/scanNetworkWithoutAPTest.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 autotests/test0AP/scanNetworkWithoutAPTest.py diff --git a/autotests/test0AP/scanNetworkWithoutAPTest.py b/autotests/test0AP/scanNetworkWithoutAPTest.py new file mode 100755 index 00000000..9aff2606 --- /dev/null +++ b/autotests/test0AP/scanNetworkWithoutAPTest.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 + +#built-in python libraries +import unittest +import dbus +import logging +import sys +sys.path.append('../utility') #needed to import all the utility modules +import utility + +# start this test without hostapd +class TestScanNetworkWithoutAP(unittest.TestCase): + + def test_scanNetworkWithoutAP(self): + logger.info(sys._getframe().f_code.co_name) + # scan and get network name + deviceList = utility.getDeviceList(bus) + networkList = utility.getNetworkList(deviceList, bus) + networkName = utility.getNetworkName(networkList) + logger.info("Network Found: %s", networkName) + # should not find any network since hostapd is not running. + self.assertEqual(networkName, "") + + @classmethod + def setUpClass(cls): + global logger, bus + utility.initLogger() + logger = logging.getLogger(__name__) + bus = dbus.SystemBus() + +if __name__ == '__main__': + unittest.main(exit=True)