

def test_prefix_search_smart(self):
    ' Test the smart prefix search function.\n        '
    schema = {
        'id': self.schema_attrs['id'],
    }
    res = self.nipap.smart_search_prefix(self.auth, schema, '1.3.3.7')
    self.assertEqual(res['interpretation'][0]['interpretation'], 'IPv4 address')
    res = self.nipap.smart_search_prefix(self.auth, schema, '1.1')
    self.assertEqual(res['interpretation'][0]['interpretation'], 'text', ("Incorrectly interpreted '1.1' as : " + res['interpretation'][0]['interpretation']))
    res = self.nipap.smart_search_prefix(self.auth, schema, '10/8')
    self.assertEqual(res['interpretation'][0]['interpretation'], 'IPv4 prefix')
    res = self.nipap.smart_search_prefix(self.auth, schema, '2000:0::01')
    self.assertEqual(res['interpretation'][0]['interpretation'], 'IPv6 address')

dataset/ETHPy150Open SpriteLink/NIPAP/tests/nipapbase.py NipapTest.test_prefix_search_smart/original