mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-07 00:57:22 +02:00
iwconfig: add test with many interface
This commit is contained in:
54
tests/fixtures/generic/iwconfig-many.json
vendored
Normal file
54
tests/fixtures/generic/iwconfig-many.json
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "wlp5s0",
|
||||||
|
"protocol": "IEEE 802.11",
|
||||||
|
"essid": "BLABLABLA",
|
||||||
|
"mode": "Managed",
|
||||||
|
"frequency": 5.18,
|
||||||
|
"frequency_unit": "GHz",
|
||||||
|
"access_point": "E6:63:DA:16:50:BF",
|
||||||
|
"bit_rate": 6.0,
|
||||||
|
"bit_rate_unit": "Mb/s",
|
||||||
|
"tx_power": 30,
|
||||||
|
"tx_power_unit": "dBm",
|
||||||
|
"retry_short_limit": 7,
|
||||||
|
"rts_threshold": false,
|
||||||
|
"fragment_threshold": false,
|
||||||
|
"power_management": true,
|
||||||
|
"link_quality": "58/70",
|
||||||
|
"signal_level": -52,
|
||||||
|
"signal_level_unit": "dBm",
|
||||||
|
"rx_invalid_nwid": 0,
|
||||||
|
"rx_invalid_crypt": 0,
|
||||||
|
"rx_invalid_frag": 0,
|
||||||
|
"tx_excessive_retries": 0,
|
||||||
|
"invalid_misc": 1766,
|
||||||
|
"missed_beacon": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "wlp5s02",
|
||||||
|
"protocol": "IEEE 802.11",
|
||||||
|
"essid": "BLABLABLA2",
|
||||||
|
"mode": "Managed",
|
||||||
|
"frequency": 5.18,
|
||||||
|
"frequency_unit": "GHz",
|
||||||
|
"access_point": "E6:63:DA:16:50:BF",
|
||||||
|
"bit_rate": 6.0,
|
||||||
|
"bit_rate_unit": "Mb/s",
|
||||||
|
"tx_power": 30,
|
||||||
|
"tx_power_unit": "dBm",
|
||||||
|
"retry_short_limit": 7,
|
||||||
|
"rts_threshold": false,
|
||||||
|
"fragment_threshold": false,
|
||||||
|
"power_management": true,
|
||||||
|
"link_quality": "58/70",
|
||||||
|
"signal_level": -53,
|
||||||
|
"signal_level_unit": "dBm",
|
||||||
|
"rx_invalid_nwid": 41,
|
||||||
|
"rx_invalid_crypt": 42,
|
||||||
|
"rx_invalid_frag": 43,
|
||||||
|
"tx_excessive_retries": 44,
|
||||||
|
"invalid_misc": 1766,
|
||||||
|
"missed_beacon": 0
|
||||||
|
}
|
||||||
|
]
|
17
tests/fixtures/generic/iwconfig-many.out
vendored
Normal file
17
tests/fixtures/generic/iwconfig-many.out
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
wlp5s0 IEEE 802.11 ESSID:"BLABLABLA"
|
||||||
|
Mode:Managed Frequency:5.18 GHz Access Point: E6:63:DA:16:50:BF
|
||||||
|
Bit Rate=6 Mb/s Tx-Power=30 dBm
|
||||||
|
Retry short limit:7 RTS thr:off Fragment thr:off
|
||||||
|
Power Management:on
|
||||||
|
Link Quality=58/70 Signal level=-52 dBm
|
||||||
|
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
|
||||||
|
Tx excessive retries:0 Invalid misc:1766 Missed beacon:0
|
||||||
|
|
||||||
|
wlp5s02 IEEE 802.11 ESSID:"BLABLABLA2"
|
||||||
|
Mode:Managed Frequency:5.18 GHz Access Point: E6:63:DA:16:50:BF
|
||||||
|
Bit Rate=6 Mb/s Tx-Power=30 dBm
|
||||||
|
Retry short limit:7 RTS thr:off Fragment thr:off
|
||||||
|
Power Management:on
|
||||||
|
Link Quality=58/70 Signal level=-53 dBm
|
||||||
|
Rx invalid nwid:41 Rx invalid crypt:42 Rx invalid frag:43
|
||||||
|
Tx excessive retries:44 Invalid misc:1766 Missed beacon:0
|
@ -12,6 +12,9 @@ class iwconfigTests(unittest.TestCase):
|
|||||||
with open(os.path.join(THIS_DIR, 'fixtures/generic/iwconfig.out'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, 'fixtures/generic/iwconfig.out'), 'r', encoding='utf-8') as f:
|
||||||
iwconfig_output = f.read()
|
iwconfig_output = f.read()
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, 'fixtures/generic/iwconfig-many.out'), 'r', encoding='utf-8') as f:
|
||||||
|
iwconfig_many_output = f.read()
|
||||||
|
|
||||||
# output
|
# output
|
||||||
with open(os.path.join(THIS_DIR, 'fixtures/generic/iwconfig.json'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, 'fixtures/generic/iwconfig.json'), 'r', encoding='utf-8') as f:
|
||||||
iwconfig_json = json.loads(f.read())
|
iwconfig_json = json.loads(f.read())
|
||||||
@ -19,6 +22,9 @@ class iwconfigTests(unittest.TestCase):
|
|||||||
with open(os.path.join(THIS_DIR, 'fixtures/generic/iwconfig-raw.json'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, 'fixtures/generic/iwconfig-raw.json'), 'r', encoding='utf-8') as f:
|
||||||
iwconfig_raw_json = json.loads(f.read())
|
iwconfig_raw_json = json.loads(f.read())
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, 'fixtures/generic/iwconfig-many.json'), 'r', encoding='utf-8') as f:
|
||||||
|
iwconfig_many_json = json.loads(f.read())
|
||||||
|
|
||||||
|
|
||||||
def test_iwconfig_nodata(self):
|
def test_iwconfig_nodata(self):
|
||||||
"""
|
"""
|
||||||
@ -38,5 +44,11 @@ class iwconfigTests(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
self.assertEqual(jc.parsers.iwconfig.parse(self.iwconfig_output, quiet=True), self.iwconfig_json)
|
self.assertEqual(jc.parsers.iwconfig.parse(self.iwconfig_output, quiet=True), self.iwconfig_json)
|
||||||
|
|
||||||
|
def test_iwconfig_many(self):
|
||||||
|
"""
|
||||||
|
Test 'iwconfig' many interface
|
||||||
|
"""
|
||||||
|
self.assertEqual(jc.parsers.iwconfig.parse(self.iwconfig_many_output, quiet=True), self.iwconfig_many_json)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Reference in New Issue
Block a user