fix: self-heal radio1 AP after stock daemon wireless writes
This commit is contained in:
@@ -292,5 +292,34 @@ class GetApRadioChannelFallbackTest(unittest.TestCase):
|
||||
self.assertEqual(payload['wpa']['channel'], 11)
|
||||
|
||||
|
||||
class GetApReconcileTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.uci = {'wlan1wpa': {'device': 'radio1', 'mode': 'ap', 'ssid': 'Corp',
|
||||
'disabled': '0', 'encryption': 'sae', 'channel': '36'}}
|
||||
self.runs = []
|
||||
server._uci_wifi_iface = lambda name: dict(self.uci.get(name, {}))
|
||||
server._uci_section = lambda name: {}
|
||||
server.daemon_sock_call = lambda method, path, body=None, timeout=10: (
|
||||
404, {'error': 'not found'})
|
||||
server.device_run = lambda args, timeout=20, input_data=None: (
|
||||
self.runs.append(list(args)) or (0, '', ''))
|
||||
|
||||
def test_missing_netdev_triggers_wifi_reload(self):
|
||||
server.os.path.exists = lambda p: False
|
||||
server.h_pineap_wifi_get_ap(ctx())
|
||||
self.assertIn(['wifi', 'reload'], self.runs)
|
||||
|
||||
def test_present_netdev_skips_reload(self):
|
||||
server.os.path.exists = lambda p: True
|
||||
server.h_pineap_wifi_get_ap(ctx())
|
||||
self.assertNotIn(['wifi', 'reload'], self.runs)
|
||||
|
||||
def test_disabled_section_skips_reload(self):
|
||||
self.uci['wlan1wpa']['disabled'] = '1'
|
||||
server.os.path.exists = lambda p: False
|
||||
server.h_pineap_wifi_get_ap(ctx())
|
||||
self.assertNotIn(['wifi', 'reload'], self.runs)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user