예제 #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)