

def test_smart_search_asn(self):
    ' Test smart_search_asn function.\n        '
    data = {
        'asn': 5,
        'name': 'Autonomous System Number 5',
    }
    asn = self.nipap.add_asn(self.auth, data)
    res = self.nipap.smart_search_asn(self.auth, 'Autonomous')
    self.assertEquals(len(res['result']), 1, 'search resulted in wrong number of hits')
    self.assertEquals(res['result'][0]['asn'], data['asn'], 'search hit got wrong asn')
    self.assertEquals(res['interpretation'][0]['attribute'], 'name', 'search term interpretated as wrong type')
    res = self.nipap.smart_search_asn(self.auth, '5')
    self.assertEquals(len(res['result']), 1, 'search resulted in wrong number of hits')
    self.assertEquals(res['result'][0]['asn'], data['asn'], 'search hit got wrong asn')
    self.assertEquals(res['interpretation'][0]['attribute'], 'asn', 'search term interpretated as wrong type')

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