

def test_search_asn(self):
    ' Test searching ASNs.\n        '
    data = {
        'asn': 4,
        'name': 'This is AS number 4',
    }
    asn = self.nipap.add_asn(self.auth, data)
    q = {
        'operator': 'equals',
        'val1': 'asn',
        'val2': data['asn'],
    }
    res = self.nipap.search_asn(data.auth, q)
    self.assertEquals(len(res['result']), 1, 'equal search resulted in wrong number of hits')
    self.assertEquals(res['result'][0]['name'], data['name'], 'search hit got wrong name')
    q = {
        'operator': 'regex_match',
        'val1': 'name',
        'val2': 'number',
    }
    res = self.nipap.search_asn(self.auth, q)
    self.assertEquals(len(res['result']), 1, 'regex search resulted in wrong number of hits')
    self.assertEquals(res['result'][0]['asn'], data['asn'], 'search hit got wrong asn')

dataset/ETHPy150Open SpriteLink/NIPAP/tests/nipapbase.py NipapTest.test_search_asn/VarMisuse@75/125 `self`->`data`