def test_ip_is_usable_invalid_ip(self): """ Test that '_ip_is_usable' returns False for an invalid IP. """ tor_ip_changer = TorIpChanger() ip_usable = tor_ip_changer._ip_is_usable("not-an-ip") self.assertFalse(ip_usable)
def test_ip_is_usable_valid_ip(self): """ Test that '_ip_is_usable' returns True for a valid IP. """ tor_ip_changer = TorIpChanger() tor_ip_changer._real_ip = "0.0.0.0" ip_usable = tor_ip_changer._ip_is_usable("1.1.1.1") self.assertTrue(ip_usable)
def test_ip_is_usable_real_ip(self): """ Test that '_ip_is_usable' returns False for the actual real IP. """ tor_ip_changer = TorIpChanger() tor_ip_changer._real_ip = "0.0.0.0" ip_usable = tor_ip_changer._ip_is_usable("0.0.0.0") self.assertFalse(ip_usable)
def test_ip_is_usable_used_ip(self): """ Test that '_ip_is_usable' returns False for an already used IP. """ tor_ip_changer = TorIpChanger() tor_ip_changer._real_ip = "0.0.0.0" tor_ip_changer.used_ips = ["1.1.1.1"] ip_usable = tor_ip_changer._ip_is_usable("1.1.1.1") self.assertFalse(ip_usable)