#NEWLINE# def test_search_asn( self ) : #NEWLINE# #INDENT# ' Search ASNs\n        ' #NEWLINE# attr = { #NEWLINE# #INDENT# 'asn' : 4 , #NEWLINE# 'name' : 'This is AS number 4' , #NEWLINE# #UNINDENT# } #NEWLINE# asn = s . add_asn ( { #NEWLINE# #INDENT# 'auth' : ad , #NEWLINE# 'attr' : attr , #NEWLINE# #UNINDENT# } ) #NEWLINE# q = { #NEWLINE# #INDENT# 'operator' : 'equals' , #NEWLINE# 'val1' : 'asn' , #NEWLINE# 'val2' : attr [ 'asn' ] , #NEWLINE# #UNINDENT# } #NEWLINE# res = s . search_asn ( { #NEWLINE# #INDENT# 'auth' : ad , #NEWLINE# 'query' : q , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEquals ( len ( res [ 'result' ] ) , 1 , 'equal search resulted in wrong number of hits' ) #NEWLINE# self . assertEquals ( res [ 'result' ] [ 0 ] [ 'name' ] , attr [ 'name' ] , 'search hit got wrong name' ) #NEWLINE# q = { #NEWLINE# #INDENT# 'operator' : 'regex_match' , #NEWLINE# 'val1' : 'name' , #NEWLINE# 'val2' : 'number' , #NEWLINE# #UNINDENT# } #NEWLINE# res = s . search_asn ( { #NEWLINE# #INDENT# 'auth' : ad , #NEWLINE# 'query' : q , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEquals ( len ( res [ 'result' ] ) , 1 , 'regex search resulted in wrong number of hits' ) #NEWLINE# self . assertEquals ( res [ 'result' ] [ 0 ] [ 'asn' ] , attr [ 'asn' ] , 'search hit got wrong asn' )