Esempio n. 1
0
    def test__WhoisLookup(self):

        data_dir = path.abspath(path.join(path.dirname(__file__), '..'))

        with io.open(str(data_dir) + '/whois.json', 'r') as data_file:
            data = json.load(data_file)

        for key, val in data.items():

            log.debug('Testing: {0}'.format(key))
            net = Net(key)
            obj = Whois(net)

            try:

                self.assertIsInstance(
                    obj.lookup(asn_data=val['asn_data'],
                               get_referral=True,
                               ignore_referral_errors=True), dict)

            except WhoisLookupError:

                pass

            except AssertionError as e:

                raise e

            except Exception as e:

                self.fail('Unexpected exception raised: {0}'.format(e))
Esempio n. 2
0
    def test__WhoisLookup(self):

        data_dir = path.dirname(__file__)

        with io.open(str(data_dir) + '/whois.json', 'r') as data_file:
            data = json.load(data_file)

        for key, val in data.items():

            log.debug('Testing: {0}'.format(key))
            net = Net(key)
            obj = Whois(net)

            try:

                self.assertIsInstance(
                    obj.lookup(response=val['response'],
                               asn_data=val['asn_data'],
                               is_offline=True,
                               inc_raw=True), dict)

            except AssertionError as e:

                raise e

            except Exception as e:

                self.fail('Unexpected exception raised: {0}'.format(e))

            self.assertRaises(NetError, Whois, 'a')
Esempio n. 3
0
    def test__WhoisLookup(self):

        data_dir = path.abspath(path.join(path.dirname(__file__), '..'))

        with io.open(str(data_dir) + '/whois.json', 'r') as data_file:
            data = json.load(data_file)

        for key, val in data.items():

            log.debug('Testing: {0}'.format(key))
            net = Net(key)
            obj = Whois(net)

            try:

                self.assertIsInstance(obj.lookup(asn_data=val['asn_data']),
                                      dict)

            except WhoisLookupError:

                pass

            except AssertionError as e:

                raise e

            except Exception as e:

                self.fail('Unexpected exception raised: %r' % e)
Esempio n. 4
0
    def test__WhoisLookup(self):

        data_dir = path.dirname(__file__)

        with io.open(str(data_dir) + '/whois.json', 'r') as data_file:
            data = json.load(data_file)

        for key, val in data.items():

            log.debug('Testing: {0}'.format(key))
            net = Net(key)
            obj = Whois(net)

            try:

                self.assertIsInstance(obj.lookup(response=val['response'],
                                                 asn_data=val['asn_data'],
                                                 is_offline=True,
                                                 inc_raw=True),
                                      dict)

            except AssertionError as e:

                raise e

            except Exception as e:

                self.fail('Unexpected exception raised: {0}'.format(e))

            self.assertRaises(NetError, Whois, 'a')