#NEWLINE# def test_create_link_with_device( self ) : #NEWLINE# #INDENT# tenant = fakes . tenants [ 'foo' ] #NEWLINE# server_id = fakes . servers [ tenant [ 'id' ] ] [ 0 ] [ 'id' ] #NEWLINE# server_url = utils . join_url ( ( self . application_url + '/' ) , ( 'compute/%s' % server_id ) ) #NEWLINE# vol_id = fakes . volumes [ tenant [ 'id' ] ] [ 0 ] [ 'id' ] #NEWLINE# vol_url = utils . join_url ( ( self . application_url + '/' ) , ( 'storage/%s' % vol_id ) ) #NEWLINE# app = self . get_app ( ) #NEWLINE# headers = { #NEWLINE# #INDENT# 'Category' : 'storagelink;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind"' , #NEWLINE# 'X-OCCI-Attribute' : ( 'occi.storagelink.deviceid="/dev/vdc", occi.core.source="%s", occi.core.target="%s"' % ( server_url , vol_url ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# req = self . _build_req ( '/storagelink' , tenant [ 'id' ] , method = 'POST' , headers = headers ) #NEWLINE# resp = req . get_response ( app ) #NEWLINE# link_id = '_' . join ( [ server_id , vol_id ] ) #NEWLINE# expected = [ ( 'X-OCCI-Location' , utils . join_url ( ( self . application_url + '/' ) , ( 'storagelink/%s' % link_id ) ) ) ] #NEWLINE# self . assertEqual ( 200 , resp . status_code ) #NEWLINE# self . assertExpectedResult ( expected , resp ) #NEWLINE# self . assertDefaults ( resp )