Example #1
0
    def test_get_asn_http(self):
        data = {
            'nets': {
                'net': {
                    'orgRef': {
                        '@handle': 'APNIC'
                    }
                }
            }
        }
        result = Net('1.2.3.4')
        try:
            self.assertIsInstance(result.get_asn_http(result=data), dict)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        data['nets']['net']['orgRef']['@handle'] = 'RIPE'
        try:
            self.assertIsInstance(result.get_asn_http(result=data), dict)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        data['nets']['net']['orgRef']['@handle'] = 'DNIC'
        try:
            self.assertIsInstance(result.get_asn_http(result=data), dict)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        data['nets']['net']['orgRef']['@handle'] = 'INVALID'
        try:
            self.assertRaises(ASNRegistryError, result.get_asn_http,
                              result=data)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        data = ''
        try:
            self.assertIsInstance(result.get_asn_http(result=data), dict)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))
Example #2
0
    def test_get_asn_http(self):
        data = {'nets': {'net': {'orgRef': {'@handle': 'APNIC'}}}}
        result = Net('1.2.3.4')
        try:
            self.assertIsInstance(result.get_asn_http(result=data), dict)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        data['nets']['net']['orgRef']['@handle'] = 'RIPE'
        try:
            self.assertIsInstance(result.get_asn_http(result=data), dict)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        data['nets']['net']['orgRef']['@handle'] = 'DNIC'
        try:
            self.assertIsInstance(result.get_asn_http(result=data), dict)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        data['nets']['net']['orgRef']['@handle'] = 'INVALID'
        try:
            self.assertRaises(ASNRegistryError,
                              result.get_asn_http,
                              result=data)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))

        data = ''
        try:
            self.assertIsInstance(result.get_asn_http(result=data), dict)
        except AssertionError as e:
            raise e
        except Exception as e:
            self.fail('Unexpected exception raised: {0}'.format(e))
Example #3
0
 def test_get_asn_http(self):
     result = Net('74.125.225.229')
     try:
         self.assertIsInstance(result.get_asn_http(), dict)
     except ASNLookupError:
         pass
     except AssertionError as e:
         raise e
     except Exception as e:
         self.fail('Unexpected exception raised: {0}'.format(e))
Example #4
0
 def test_get_asn_http(self):
     result = Net('74.125.225.229')
     try:
         self.assertIsInstance(result.get_asn_http(), dict)
     except ASNLookupError:
         pass
     except AssertionError as e:
         raise e
     except Exception as e:
         self.fail('Unexpected exception raised: {0}'.format(e))