示例#1
0
 def test_normalized_frequency(self):
     cell = Cell.from_string(FREQUENCY_5G)
     self.assertEqual(cell.frequency_norm, '5Ghz')
     cell = Cell.from_string(IWLIST_SCAN_WPA2)
     self.assertEqual(cell.frequency_norm, '2.4Ghz')
     cell = Cell.from_string(FREQUENCY_UNSUPPORTED)
     self.assertIsNone(cell.frequency_norm)
示例#2
0
 def test_bssid(self):
     # This seems like a useless test, yet if bssid is refactored and not
     # in sync with address attribute, this will alert us.
     cell = Cell.from_string(ALTERNATIVE_OUTPUT)
     self.assertEqual(cell.address, cell.bssid)
     cell.bssid = 'AC:22:05:25:3B:6A'
     self.assertEqual('AC:22:05:25:3B:6A', cell.address)
示例#3
0
 def test_no_encryption(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertFalse(cell.encrypted)
     self.assertEqual('My Wireless Network', cell.ssid)
     self.assertEqual(-51, cell.signal)
     self.assertEqual('59/70', cell.quality)
     self.assertEqual('2.437 GHz', cell.frequency)
     self.assertEqual('Master', cell.mode)
     self.assertEqual(6, cell.channel)
示例#4
0
 def test_no_encryption(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertFalse(cell.encrypted)
     self.assertEqual(cell.ssid, 'My Wireless Network')
     self.assertEqual(cell.signal, -51)
     self.assertEqual(cell.quality, '59/70')
     self.assertEqual(cell.frequency, '2.437 GHz')
     self.assertEqual(cell.mode, 'Master')
     self.assertEqual(cell.channel, 6)
示例#5
0
 def test_no_encryption(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertFalse(cell.encrypted)
     self.assertEqual(cell.ssid, 'My Wireless Network')
     self.assertEqual(cell.signal, -51)
     self.assertEqual(cell.quality, '59/70')
     self.assertEqual(cell.frequency, '2.437 GHz')
     self.assertEqual(cell.mode, 'Master')
     self.assertEqual(cell.channel, 6)
示例#6
0
 def test_wpa2(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA2)
     self.assertTrue(cell.encrypted)
     self.assertEqual(cell.encryption_type, 'wpa2')
示例#7
0
 def test_frequency_no_channel_output(self):
     # https://github.com/rockymeza/wifi/issues/39
     cell = Cell.from_string(FREQUENCY_NO_CHANNEL_OUTPUT)
     self.assertEqual(cell.channel, 149)
示例#8
0
 def test_alternative_iwlist_output(self):
     # https://github.com/rockymeza/wifi/issues/12
     cell = Cell.from_string(ALTERNATIVE_OUTPUT)
     self.assertEqual(cell.quality, '78/100')
     self.assertEqual(cell.signal, -92)
示例#9
0
 def test_noname_cell(self):
     cell = Cell.from_string(NONAME_WIRELESS_NETWORK)
     self.assertEqual(cell.ssid, '')
示例#10
0
 def test_alternative_iwlist_output(self):
     # https://github.com/rockymeza/wifi/issues/12
     cell = Cell.from_string(ALTERNATIVE_OUTPUT)
     self.assertEqual(cell.quality, '78/100')
     self.assertEqual(cell.signal, -92)
示例#11
0
 def test_wep(self):
     cell = Cell.from_string(IWLIST_SCAN_WEP)
     self.assertTrue(cell.encrypted)
     self.assertEqual(cell.encryption_type, 'wep')
示例#12
0
 def test_pairwise_ciphers(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA_WPA2_DUAL_CIPHERS)
     self.assertListEqual(['CCMP', 'TKIP'], cell.pairwise_ciphers)
示例#13
0
 def test_wpa_enterprise(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA_ENTERPRISE)
     self.assertTrue(cell.encrypted)
     self.assertEqual('wpa-enterprise', cell.encryption_type)
示例#14
0
 def test_wpa_wpa2(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA_WPA2)
     self.assertTrue(cell.encrypted)
     self.assertEqual('wpa/wpa2', cell.encryption_type)
示例#15
0
 def test_unimplemented(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA_ENTERPRISE)
     with self.assertRaises(NotImplementedError):
         cell.gen_wpasup_cfg('supersecret')
示例#16
0
 def test_open_ap(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertEqual(WSCFG_OPEN, cell.gen_wpasup_cfg())
示例#17
0
 def test_wpa2_psk(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA2)
     self.assertEqual(WSCFG_WPA2, cell.gen_wpasup_cfg('supersecret'))
示例#18
0
 def test_blank_ssid(self):
     # https://github.com/rockymeza/wifi/issues/86
     cell = Cell.from_string(NO_SSID_AT_ALL)
     self.assertEqual(cell.ssid, None)
示例#19
0
 def test_group_cipher(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA2)
     self.assertEqual('CCMP', cell.group_cipher)
示例#20
0
 def test_noise_no_data(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertEqual(cell.noise, None)
示例#21
0
 def test_noise_data_present(self):
     cell = Cell.from_string(LIST_INDEX_ERROR)
     self.assertEqual(cell.noise, -92)
示例#22
0
 def test_no_channel_output(self):
     cell = Cell.from_string(NO_CHANNEL_OUTPUT)
     self.assertEqual(11, cell.channel)
示例#23
0
 def test_list_index_error(self):
     cell = Cell.from_string(LIST_INDEX_ERROR)
示例#24
0
 def test_frequency_no_channel_output(self):
     cell = Cell.from_string(FREQUENCY_NO_CHANNEL_OUTPUT)
     self.assertEqual(149, cell.channel)
示例#25
0
 def test_wpa1(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA1)
     self.assertTrue(cell.encrypted)
     self.assertEqual(cell.encryption_type, 'wpa')
示例#26
0
 def test_noname_cell(self):
     cell = Cell.from_string(NONAME_WIRELESS_NETWORK)
     self.assertEqual(cell.ssid, '')
示例#27
0
 def test_signal_level_out_of_sixty(self):
     cell = Cell.from_string(ALTERNATIVE_OUTPUT2)
     self.assertEqual(cell.signal, -71)
示例#28
0
 def test_list_index_error(self):
     # https://github.com/rockymeza/wifi/issues/42
     cell = Cell.from_string(LIST_INDEX_ERROR)
示例#29
0
 def test_no_channel_output(self):
     # https://github.com/rockymeza/wifi/issues/24
     cell = Cell.from_string(NO_CHANNEL_OUTPUT)
     self.assertEqual(cell.channel, 11)
示例#30
0
 def test_absolute_quality(self):
     # https://github.com/rockymeza/wifi/pull/45
     cell = Cell.from_string(ABSOLUTE_QUALITY)
     self.assertEqual(cell.quality, '38/100')
     self.assertEqual(cell.signal, -92)
示例#31
0
 def test_signal_level_out_of_sixty(self):
     cell = Cell.from_string(ALTERNATIVE_OUTPUT2)
     self.assertEqual(cell.signal, -71)
示例#32
0
 def test_list_index_error(self):
     # https://github.com/rockymeza/wifi/issues/42
     cell = Cell.from_string(LIST_INDEX_ERROR)
示例#33
0
 def test_no_channel_output(self):
     # https://github.com/rockymeza/wifi/issues/24
     cell = Cell.from_string(NO_CHANNEL_OUTPUT)
     self.assertEqual(cell.channel, 11)
示例#34
0
 def test_absolute_quality(self):
     # https://github.com/rockymeza/wifi/pull/45
     cell = Cell.from_string(ABSOLUTE_QUALITY)
     self.assertEqual('38/100', cell.quality)
     self.assertEqual(-92, cell.signal)
示例#35
0
 def test_frequency_no_channel_output(self):
     # https://github.com/rockymeza/wifi/issues/39
     cell = Cell.from_string(FREQUENCY_NO_CHANNEL_OUTPUT)
     self.assertEqual(cell.channel, 149)
示例#36
0
 def test_blank_ssid(self):
     cell = Cell.from_string(NO_SSID_AT_ALL)
     self.assertEqual(None, cell.ssid)
示例#37
0
 def test_wep(self):
     cell = Cell.from_string(IWLIST_SCAN_WEP)
     self.assertTrue(cell.encrypted)
     self.assertEqual(cell.encryption_type, 'wep')
示例#38
0
 def test_noise_no_data(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertEqual(None, cell.noise)
示例#39
0
 def test_noise_data_present(self):
     cell = Cell.from_string(LIST_INDEX_ERROR)
     self.assertEqual(-92, cell.noise)
示例#40
0
 def test_blank_ssid(self):
     # https://github.com/rockymeza/wifi/issues/86
     cell = Cell.from_string(NO_SSID_AT_ALL)
     self.assertEqual(cell.ssid, None)