#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . keystone : ( 'domain_get' , 'domain_update' , 'get_default_role' , 'role_list' , 'group_list' , 'roles_for_group' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_update_domain_post_error( self ) : #NEWLINE# #INDENT# default_role = self . roles . first ( ) #NEWLINE# domain = self . domains . get ( id = '1' ) #NEWLINE# test_description = 'updated description' #NEWLINE# groups = self . _get_all_groups ( domain . id ) #NEWLINE# roles = self . roles . list ( ) #NEWLINE# api . keystone . domain_get ( IsA ( http . HttpRequest ) , '1' ) . AndReturn ( domain ) #NEWLINE# api . keystone . get_default_role ( IsA ( http . HttpRequest ) ) . MultipleTimes ( ) . AndReturn ( default_role ) #NEWLINE# api . keystone . role_list ( IsA ( http . HttpRequest ) ) . MultipleTimes ( ) . AndReturn ( roles ) #NEWLINE# api . keystone . group_list ( IsA ( http . HttpRequest ) , domain = domain . id ) . AndReturn ( groups ) #NEWLINE# for group in groups : #NEWLINE# #INDENT# api . keystone . roles_for_group ( IsA ( http . HttpRequest ) , group = group . id , domain = domain . id ) . AndReturn ( roles ) #NEWLINE# #UNINDENT# workflow_data = self . _get_workflow_data ( domain ) #NEWLINE# workflow_data [ 'description' ] = test_description #NEWLINE# workflow_data [ ( GROUP_ROLE_PREFIX + '1' ) ] = [ '3' ] #NEWLINE# workflow_data [ ( GROUP_ROLE_PREFIX + '2' ) ] = [ '2' ] #NEWLINE# api . keystone . domain_update ( IsA ( http . HttpRequest ) , description = test_description , domain_id = domain . id , enabled = domain . enabled , name = domain . name ) . AndRaise ( self . exceptions . keystone ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# res = self . client . post ( DOMAIN_UPDATE_URL , workflow_data ) #NEWLINE# self . assertNoFormErrors ( res ) #NEWLINE# self . assertMessageCount ( error = 1 ) #NEWLINE# self . assertRedirectsNoFollow ( res , DOMAINS_INDEX_URL )