#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# cinder : ( 'volume_create' , 'volume_snapshot_list' , 'volume_type_list' ) , #NEWLINE# api . glance : ( 'image_list_detailed' , ) , #NEWLINE# quotas : ( 'tenant_limit_usages' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_create_volume_dropdown( self ) : #NEWLINE# #INDENT# volume = self . volumes . first ( ) #NEWLINE# usage_limit = { #NEWLINE# #INDENT# 'maxTotalVolumeGigabytes' : 250 , #NEWLINE# 'gigabytesUsed' : 20 , #NEWLINE# 'volumesUsed' : len ( self . volumes . list ( ) ) , #NEWLINE# 'maxTotalVolumes' : 6 , #NEWLINE# #UNINDENT# } #NEWLINE# formData = { #NEWLINE# #INDENT# 'name' : 'A Volume I Am Making' , #NEWLINE# 'description' : 'This is a volume I am making for a test.' , #NEWLINE# 'method' : 'CreateForm' , #NEWLINE# 'size' : 50 , #NEWLINE# 'type' : '' , #NEWLINE# 'volume_source_type' : 'no_source_type' , #NEWLINE# 'snapshot_source' : self . volume_snapshots . first ( ) . id , #NEWLINE# 'image_source' : self . images . first ( ) . id , #NEWLINE# #UNINDENT# } #NEWLINE# cinder . volume_type_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . volume_types . list ( ) ) #NEWLINE# cinder . volume_snapshot_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . volume_snapshots . list ( ) ) #NEWLINE# api . glance . image_list_detailed ( IsA ( http . HttpRequest ) , filters = { #NEWLINE# #INDENT# 'is_public' : True , #NEWLINE# 'status' : 'active' , #NEWLINE# #UNINDENT# } ) . AndReturn ( [ self . images . list ( ) , False ] ) #NEWLINE# api . glance . image_list_detailed ( IsA ( http . HttpRequest ) , filters = { #NEWLINE# #INDENT# 'property-owner_id' : self . tenant . id , #NEWLINE# 'status' : 'active' , #NEWLINE# #UNINDENT# } ) . AndReturn ( [ [ ] , False ] ) #NEWLINE# quotas . tenant_limit_usages ( IsA ( http . HttpRequest ) ) . AndReturn ( usage_limit ) #NEWLINE# cinder . volume_create ( IsA ( http . HttpRequest ) , formData [ 'size' ] , formData [ 'name' ] , formData [ 'description' ] , '' , metadata = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , snapshot_id = None , image_id = None ) . AndReturn ( volume ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# url = reverse ( 'horizon:project:volumes:create' ) #NEWLINE# res = self . client . post ( url , formData ) #NEWLINE# redirect_url = reverse ( 'horizon:project:volumes:index' ) #NEWLINE# self . assertRedirectsNoFollow ( res , url )