Exemplo n.º 1
0
    def test_get_whois(self):
        result = Net('74.125.225.229')
        try:
            self.assertIsInstance(result.get_whois(), str)
        except WhoisLookupError:
            pass
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        self.assertRaises(WhoisLookupError, result.get_whois, **dict(
            retry_count=0, server='arin.net'))

        self.assertRaises(BlacklistError, result.get_whois, **dict(
            server='whois.arin.net', extra_blacklist=['whois.arin.net']))

        result = Net(address='74.125.225.229', timeout=0)
        self.assertRaises(WhoisLookupError, result.get_whois, **dict(
            retry_count=1))