#NEWLINE# def test_create( self ) : #NEWLINE# #INDENT# userdata = '#!/bin/sh echo "Hello"' #NEWLINE# f = tempfile . TemporaryFile ( ) #NEWLINE# f . write ( userdata ) #NEWLINE# f . seek ( 0 ) #NEWLINE# params = { #NEWLINE# #INDENT# 'name' : 'proxy' , #NEWLINE# 'nova_flavor_id' : 1 , #NEWLINE# 'glance_image_id' : '22222222' , #NEWLINE# 'keypair_id' : '33333333' , #NEWLINE# 'securitygroup_ids' : [ '44444444' , '55555555' ] , #NEWLINE# 'userdata' : f , #NEWLINE# 'args' : { #NEWLINE# #INDENT# 'key1' : 'value1' , #NEWLINE# 'key2' : 'value2' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# proxy = self . cs . proxy . create ( self . gid , ** proxy ) #NEWLINE# body = self . _create_body ( ** params ) #NEWLINE# body [ 'proxy' ] [ 'userdata' ] = base64 . b64encode ( userdata ) #NEWLINE# self . cs . assert_called ( 'POST' , ( '/groups/%s/proxy' % self . gid ) , body ) #NEWLINE# self . assertIsInstance ( proxy , self . proxy_type )