def stub_out_glanceclient_create(stubs, sent_to_glance):
 orig_add_image = glanceclient.v1.images.ImageManager.create
 def fake_create(context, metadata, data=None):
  sent_to_glance['metadata'] = metadata
  sent_to_glance['data'] = data
  return orig_add_image(metadata, data)
 stubs.Set(glanceclient.v1.images.ImageManager, 'create', fake_create)

def stub_out_glanceclient_create ( stubs , sent_to_glance ) : orig_add_image = glanceclient . v1 . images . ImageManager . create def fake_create ( context , metadata , data = None ) : sent_to_glance [ 'metadata' ] = metadata sent_to_glance [ 'data' ] = data return orig_add_image ( metadata , data ) stubs . Set ( glanceclient . v1 . images . ImageManager , 'create' , fake_create )
we return the metadata sent to glance by modifying the sent_to_glance dict in place .