#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . cinder : ( 'qos_spec_list' , 'qos_spec_get' , 'qos_spec_get_associations' , 'volume_type_get' , 'qos_spec_associate' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_associate_qos_spec( self ) : #NEWLINE# #INDENT# volume_type = self . volume_types . first ( ) #NEWLINE# volume_types = self . volume_types . list ( ) #NEWLINE# qos_spec = self . cinder_qos_specs . first ( ) #NEWLINE# qos_specs = self . cinder_qos_specs . list ( ) #NEWLINE# formData = { #NEWLINE# #INDENT# 'qos_spec_choice' : qos_spec . id , #NEWLINE# #UNINDENT# } #NEWLINE# edit_url = reverse ( 'horizon:admin:volumes:volume_types:manage_qos_spec_association' , args = [ volume_type . id ] ) #NEWLINE# api . cinder . qos_spec_get ( IsA ( http . HttpRequest ) , qos_spec . id ) . AndReturn ( qos_spec ) #NEWLINE# api . cinder . qos_spec_list ( IsA ( http . HttpRequest ) ) . AndReturn ( qos_specs ) #NEWLINE# api . cinder . qos_spec_get_associations ( IsA ( http . HttpRequest ) , qos_spec . id ) . AndReturn ( volume_types ) #NEWLINE# api . cinder . qos_spec_get_associations ( IsA ( http . HttpRequest ) , qos_specs [ 1 ] . id ) . AndReturn ( volume_types ) #NEWLINE# api . cinder . volume_type_get ( IsA ( http . HttpRequest ) , str ( volume_type . id ) ) . AndReturn ( volume_type ) #NEWLINE# api . cinder . qos_spec_associate ( IsA ( http . HttpRequest ) , qos_spec , str ( volume_type . id ) ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# resp = self . client . post ( edit_url , formData ) #NEWLINE# redirect = reverse ( 'horizon:admin:volumes:volume_types_tab' ) #NEWLINE# self . assertNoFormErrors ( resp ) #NEWLINE# self . assertMessageCount ( success = 1 ) #NEWLINE# self . assertRedirectsNoFollow ( resp , redirect )