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