Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 6
0
 def test_wpa2(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA2)
     self.assertTrue(cell.encrypted)
     self.assertEqual(cell.encryption_type, 'wpa2')
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 9
0
 def test_noname_cell(self):
     cell = Cell.from_string(NONAME_WIRELESS_NETWORK)
     self.assertEqual(cell.ssid, '')
Ejemplo n.º 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)
Ejemplo n.º 11
0
 def test_wep(self):
     cell = Cell.from_string(IWLIST_SCAN_WEP)
     self.assertTrue(cell.encrypted)
     self.assertEqual(cell.encryption_type, 'wep')
Ejemplo n.º 12
0
 def test_pairwise_ciphers(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA_WPA2_DUAL_CIPHERS)
     self.assertListEqual(['CCMP', 'TKIP'], cell.pairwise_ciphers)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 15
0
 def test_unimplemented(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA_ENTERPRISE)
     with self.assertRaises(NotImplementedError):
         cell.gen_wpasup_cfg('supersecret')
Ejemplo n.º 16
0
 def test_open_ap(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertEqual(WSCFG_OPEN, cell.gen_wpasup_cfg())
Ejemplo n.º 17
0
 def test_wpa2_psk(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA2)
     self.assertEqual(WSCFG_WPA2, cell.gen_wpasup_cfg('supersecret'))
Ejemplo n.º 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)
Ejemplo n.º 19
0
 def test_group_cipher(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA2)
     self.assertEqual('CCMP', cell.group_cipher)
Ejemplo n.º 20
0
 def test_noise_no_data(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertEqual(cell.noise, None)
Ejemplo n.º 21
0
 def test_noise_data_present(self):
     cell = Cell.from_string(LIST_INDEX_ERROR)
     self.assertEqual(cell.noise, -92)
Ejemplo n.º 22
0
 def test_no_channel_output(self):
     cell = Cell.from_string(NO_CHANNEL_OUTPUT)
     self.assertEqual(11, cell.channel)
Ejemplo n.º 23
0
 def test_list_index_error(self):
     cell = Cell.from_string(LIST_INDEX_ERROR)
Ejemplo n.º 24
0
 def test_frequency_no_channel_output(self):
     cell = Cell.from_string(FREQUENCY_NO_CHANNEL_OUTPUT)
     self.assertEqual(149, cell.channel)
Ejemplo n.º 25
0
 def test_wpa1(self):
     cell = Cell.from_string(IWLIST_SCAN_WPA1)
     self.assertTrue(cell.encrypted)
     self.assertEqual(cell.encryption_type, 'wpa')
Ejemplo n.º 26
0
 def test_noname_cell(self):
     cell = Cell.from_string(NONAME_WIRELESS_NETWORK)
     self.assertEqual(cell.ssid, '')
Ejemplo n.º 27
0
 def test_signal_level_out_of_sixty(self):
     cell = Cell.from_string(ALTERNATIVE_OUTPUT2)
     self.assertEqual(cell.signal, -71)
Ejemplo n.º 28
0
 def test_list_index_error(self):
     # https://github.com/rockymeza/wifi/issues/42
     cell = Cell.from_string(LIST_INDEX_ERROR)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 31
0
 def test_signal_level_out_of_sixty(self):
     cell = Cell.from_string(ALTERNATIVE_OUTPUT2)
     self.assertEqual(cell.signal, -71)
Ejemplo n.º 32
0
 def test_list_index_error(self):
     # https://github.com/rockymeza/wifi/issues/42
     cell = Cell.from_string(LIST_INDEX_ERROR)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 36
0
 def test_blank_ssid(self):
     cell = Cell.from_string(NO_SSID_AT_ALL)
     self.assertEqual(None, cell.ssid)
Ejemplo n.º 37
0
 def test_wep(self):
     cell = Cell.from_string(IWLIST_SCAN_WEP)
     self.assertTrue(cell.encrypted)
     self.assertEqual(cell.encryption_type, 'wep')
Ejemplo n.º 38
0
 def test_noise_no_data(self):
     cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION)
     self.assertEqual(None, cell.noise)
Ejemplo n.º 39
0
 def test_noise_data_present(self):
     cell = Cell.from_string(LIST_INDEX_ERROR)
     self.assertEqual(-92, cell.noise)
Ejemplo n.º 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)