#NEWLINE# def _test_links( self , public_url = None ) : #NEWLINE# #INDENT# cfg . CONF . set_override ( 'public_endpoint' , public_url , 'api' ) #NEWLINE# uuid = uuidutils . generate_uuid ( ) #NEWLINE# obj_utils . create_test_port ( self . context , uuid = uuid , node_id = self . node . id ) #NEWLINE# data = self . get_json ( ( '/ports/%s' % uuid ) ) #NEWLINE# self . assertIn ( 'links' , data . keys ( ) ) #NEWLINE# self . assertEqual ( 2 , len ( data [ 'links' ] ) ) #NEWLINE# self . assertIn ( uuid , data [ 'links' ] [ 0 ] [ 'href' ] ) #NEWLINE# for l in data [ 'links' ] : #NEWLINE# #INDENT# bookmark = ( l [ 'rel' ] == 'bookmark' ) #NEWLINE# self . assertTrue ( self . validate_link ( data [ 'href' ] , bookmark = bookmark ) ) #NEWLINE# #UNINDENT# if ( public_url is not None ) : #NEWLINE# #INDENT# expected = [ { #NEWLINE# #INDENT# 'href' : ( '%s/v1/ports/%s' % ( public_url , uuid ) ) , #NEWLINE# 'rel' : 'self' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'href' : ( '%s/ports/%s' % ( public_url , uuid ) ) , #NEWLINE# 'rel' : 'bookmark' , #NEWLINE# #UNINDENT# } ] #NEWLINE# for i in expected : #NEWLINE# #INDENT# self . assertIn ( i , data [ 'links' ] )