def test_network(self): """ NetworkBase has a couple of method sketches that do not do anything but are used by child classes. """ nb = NetworkBase() self.assertEqual(asyncio.get_event_loop().run_until_complete(nb.start_network()), None) self.assertEqual(asyncio.get_event_loop().run_until_complete(nb.stop_network()), None) self.assertEqual(asyncio.get_event_loop().run_until_complete(nb.check_network()), NetworkStatus.NOT_CONNECTED)
def test_init(self): """ This lets us know if the initial values have changed and extends code coverage to the class's properties. """ nb = NetworkBase() self.assertEqual(nb.network_status, NetworkStatus.STOPPED) self.assertEqual(nb.check_network_task, None) self.assertEqual(nb.check_network_interval, 60.0) self.assertEqual(nb.network_error_wait_time, 60.0) self.assertEqual(nb.check_network_timeout, 60.0) self.assertEqual(nb.started, False) # test that setters work nb.check_network_interval = 15.0 self.assertEqual(nb.check_network_interval, 15.0) nb.network_error_wait_time = 25.0 self.assertEqual(nb.network_error_wait_time, 25.0) nb.check_network_timeout = 45.0 self.assertEqual(nb.check_network_timeout, 45.0)
def test_start_and_stop_network(self): """ Assert that start and stop update the started property. """ nb = NetworkBase() nb.start() self.assertEqual(nb.started, True) nb.stop() self.assertEqual(nb.started, False)
def stop(self): NetworkBase.stop(self)
def start(self): NetworkBase.start(self)