def test_search_asn(self):

        attr = {
            'asn': 4,
            'name': 'This is AS number 4'
        }

        asn = s.add_asn({ 'auth': ad, 'attr': attr })

        # equal match
        q = {
            'operator': 'equals',
            'val1': 'asn',
            'val2': attr['asn']
        }
        res = s.search_asn({ 'auth': ad, 'query': q })
        self.assertEquals(len(res['result']), 1, "equal search resulted in wrong number of hits")
        self.assertEquals(res['result'][0]['name'], attr['name'], "search hit got wrong name")

        # regexp match
        q = {
            'operator': 'regex_match',
            'val1': 'name',
            'val2': 'number'
        }
        res = s.search_asn({ 'auth': ad, 'query': q })
        self.assertEquals(len(res['result']), 1, "regex search resulted in wrong number of hits")
        self.assertEquals(res['result'][0]['asn'], attr['asn'], "search hit got wrong asn")
Search ASNs
dataset/ETHPy150Open SpriteLink/NIPAP/tests/xmlrpc.py/NipapXmlTest.test_search_asn