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)
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)
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)
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)
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)
def test_wpa2(self): cell = Cell.from_string(IWLIST_SCAN_WPA2) self.assertTrue(cell.encrypted) self.assertEqual(cell.encryption_type, 'wpa2')
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)
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)
def test_noname_cell(self): cell = Cell.from_string(NONAME_WIRELESS_NETWORK) self.assertEqual(cell.ssid, '')
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)
def test_wep(self): cell = Cell.from_string(IWLIST_SCAN_WEP) self.assertTrue(cell.encrypted) self.assertEqual(cell.encryption_type, 'wep')
def test_pairwise_ciphers(self): cell = Cell.from_string(IWLIST_SCAN_WPA_WPA2_DUAL_CIPHERS) self.assertListEqual(['CCMP', 'TKIP'], cell.pairwise_ciphers)
def test_wpa_enterprise(self): cell = Cell.from_string(IWLIST_SCAN_WPA_ENTERPRISE) self.assertTrue(cell.encrypted) self.assertEqual('wpa-enterprise', cell.encryption_type)
def test_wpa_wpa2(self): cell = Cell.from_string(IWLIST_SCAN_WPA_WPA2) self.assertTrue(cell.encrypted) self.assertEqual('wpa/wpa2', cell.encryption_type)
def test_unimplemented(self): cell = Cell.from_string(IWLIST_SCAN_WPA_ENTERPRISE) with self.assertRaises(NotImplementedError): cell.gen_wpasup_cfg('supersecret')
def test_open_ap(self): cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION) self.assertEqual(WSCFG_OPEN, cell.gen_wpasup_cfg())
def test_wpa2_psk(self): cell = Cell.from_string(IWLIST_SCAN_WPA2) self.assertEqual(WSCFG_WPA2, cell.gen_wpasup_cfg('supersecret'))
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)
def test_group_cipher(self): cell = Cell.from_string(IWLIST_SCAN_WPA2) self.assertEqual('CCMP', cell.group_cipher)
def test_noise_no_data(self): cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION) self.assertEqual(cell.noise, None)
def test_noise_data_present(self): cell = Cell.from_string(LIST_INDEX_ERROR) self.assertEqual(cell.noise, -92)
def test_no_channel_output(self): cell = Cell.from_string(NO_CHANNEL_OUTPUT) self.assertEqual(11, cell.channel)
def test_list_index_error(self): cell = Cell.from_string(LIST_INDEX_ERROR)
def test_frequency_no_channel_output(self): cell = Cell.from_string(FREQUENCY_NO_CHANNEL_OUTPUT) self.assertEqual(149, cell.channel)
def test_wpa1(self): cell = Cell.from_string(IWLIST_SCAN_WPA1) self.assertTrue(cell.encrypted) self.assertEqual(cell.encryption_type, 'wpa')
def test_noname_cell(self): cell = Cell.from_string(NONAME_WIRELESS_NETWORK) self.assertEqual(cell.ssid, '')
def test_signal_level_out_of_sixty(self): cell = Cell.from_string(ALTERNATIVE_OUTPUT2) self.assertEqual(cell.signal, -71)
def test_list_index_error(self): # https://github.com/rockymeza/wifi/issues/42 cell = Cell.from_string(LIST_INDEX_ERROR)
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)
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)
def test_signal_level_out_of_sixty(self): cell = Cell.from_string(ALTERNATIVE_OUTPUT2) self.assertEqual(cell.signal, -71)
def test_list_index_error(self): # https://github.com/rockymeza/wifi/issues/42 cell = Cell.from_string(LIST_INDEX_ERROR)
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)
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)
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)
def test_blank_ssid(self): cell = Cell.from_string(NO_SSID_AT_ALL) self.assertEqual(None, cell.ssid)
def test_wep(self): cell = Cell.from_string(IWLIST_SCAN_WEP) self.assertTrue(cell.encrypted) self.assertEqual(cell.encryption_type, 'wep')
def test_noise_no_data(self): cell = Cell.from_string(IWLIST_SCAN_NO_ENCRYPTION) self.assertEqual(None, cell.noise)
def test_noise_data_present(self): cell = Cell.from_string(LIST_INDEX_ERROR) self.assertEqual(-92, cell.noise)
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)