#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . nova : ( 'default_quota_update' , ) , #NEWLINE# api . cinder : ( 'default_quota_update' , ) , #NEWLINE# quotas : ( 'get_default_quota_data' , 'get_disabled_quotas' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_update_default_quotas( self ) : #NEWLINE# #INDENT# quota = self . quotas . first ( ) #NEWLINE# quotas . get_disabled_quotas ( IsA ( http . HttpRequest ) ) . AndReturn ( self . disabled_quotas . first ( ) ) #NEWLINE# quotas . get_default_quota_data ( IsA ( http . HttpRequest ) ) . AndReturn ( updated_quota ) #NEWLINE# quota [ 0 ] . limit = 123 #NEWLINE# quota [ 1 ] . limit = ( - 1 ) #NEWLINE# updated_quota = self . _get_quota_info ( quota ) #NEWLINE# nova_fields = ( quotas . NOVA_QUOTA_FIELDS + quotas . MISSING_QUOTA_FIELDS ) #NEWLINE# nova_updated_quota = dict ( [ ( key , updated_quota [ key ] ) for key in nova_fields if ( key != 'fixed_ips' ) ] ) #NEWLINE# api . nova . default_quota_update ( IsA ( http . HttpRequest ) , ** nova_updated_quota ) #NEWLINE# cinder_updated_quota = dict ( [ ( key , updated_quota [ key ] ) for key in quotas . CINDER_QUOTA_FIELDS ] ) #NEWLINE# api . cinder . default_quota_update ( IsA ( http . HttpRequest ) , ** cinder_updated_quota ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# url = reverse ( 'horizon:admin:defaults:update_defaults' ) #NEWLINE# res = self . client . post ( url , updated_quota ) #NEWLINE# self . assertNoFormErrors ( res ) #NEWLINE# self . assertRedirectsNoFollow ( res , INDEX_URL )