Skip to content

Commit

Permalink
[req-changes] Removed pprint and refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Mar 18, 2024
1 parent d6f19ac commit e0049b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions netjsonconfig/backends/openwrt/converters/wireless.py
Expand Up @@ -144,9 +144,9 @@ def __intermediate_encryption_wpa_enterprise(self, wireless, encryption, uci):
if option in encryption:
uci[f'auth_{option}'] = encryption[option]
uci['auth_secret'] = encryption['key']
if not encryption.get('acct_secret'):
if 'acct_secret' not in encryption:
uci['acct_secret'] = encryption['key']
if encryption.get('acct_server_port'):
if 'acct_server_port' in encryption:
uci['acct_port'] = encryption.pop('acct_server_port')

roaming_properties = (
Expand Down Expand Up @@ -338,14 +338,14 @@ def __netjson_encryption(self, wifi): # noqa: C901
if 'enterprise' in settings['protocol']:
if 'auth_secret' in settings:
settings['key'] = settings.pop('auth_secret')
if settings.get('acct_secret') and settings['acct_secret'] == settings.get(
if 'acct_secret' in settings and settings['acct_secret'] == settings.get(
'key'
):
settings.pop('acct_secret')
for option in ['server', 'port']:
if f'auth_{option}' in settings:
settings[option] = settings.pop(f'auth_{option}')
if settings.get('acct_port'):
if 'acct_port' in settings:
settings['acct_server_port'] = settings.pop('acct_port')
# Management Frame Protection
if 'ieee80211w' in wifi:
Expand Down
3 changes: 0 additions & 3 deletions tests/openwrt/test_encryption.py
Expand Up @@ -383,9 +383,6 @@ def test_render_wpa3_enterprise(self):

def test_parse_wpa3_enterprise(self):
o = OpenWrt(native=self._wpa3_enterprise_ap_uci)
from pprint import pprint

pprint(dict(o.config))
self.assertEqual(o.config, self._wpa3_enterprise_ap_netjson)

_wpa2_enterprise_ap_netjson = {
Expand Down

0 comments on commit e0049b6

Please sign in to comment.