#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . keystone : ( 'tenant_get' , 'domain_get' , 'tenant_update' , 'get_default_role' , 'roles_for_user' , 'remove_tenant_user_role' , 'add_tenant_user_role' , 'user_list' , 'roles_for_group' , 'remove_group_role' , 'add_group_role' , 'group_list' , 'role_list' , 'role_assignments_list' ) , #NEWLINE# quotas : ( 'get_tenant_quota_data' , 'get_disabled_quotas' , 'tenant_quota_usages' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_update_project_member_update_error( self ) : #NEWLINE# #INDENT# keystone_api_version = api . keystone . VERSIONS . active #NEWLINE# project = self . tenants . first ( ) #NEWLINE# quota = self . quotas . first ( ) #NEWLINE# default_role = self . roles . first ( ) #NEWLINE# domain_id = project . domain_id #NEWLINE# users = self . _get_all_users ( domain_id ) #NEWLINE# proj_users = self . _get_proj_users ( project . id ) #NEWLINE# groups = self . _get_all_groups ( domain_id ) #NEWLINE# roles = self . roles . list ( ) #NEWLINE# role_assignments = self . _get_proj_role_assignment ( project . id ) #NEWLINE# quota_usages = self . quota_usages . first ( ) #NEWLINE# api . keystone . tenant_get ( IsA ( http . HttpRequest ) , self . tenant . id , admin = True ) . AndReturn ( project ) #NEWLINE# api . keystone . domain_get ( IsA ( http . HttpRequest ) , domain_id ) . AndReturn ( self . domain ) #NEWLINE# quotas . get_disabled_quotas ( IsA ( http . HttpRequest ) ) . AndReturn ( self . disabled_quotas . first ( ) ) #NEWLINE# quotas . get_tenant_quota_data ( IsA ( http . HttpRequest ) , tenant_id = self . tenant . id ) . AndReturn ( quota ) #NEWLINE# api . keystone . get_default_role ( IsA ( http . HttpRequest ) ) . MultipleTimes ( ) . AndReturn ( default_role ) #NEWLINE# api . keystone . user_list ( IsA ( http . HttpRequest ) , domain = domain_id ) . AndReturn ( users ) #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# workflow_data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( keystone_api_version >= 3 ) : #NEWLINE# #INDENT# api . keystone . role_assignments_list ( IsA ( http . HttpRequest ) , project = self . tenant . id ) . AndReturn ( role_assignments ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# api . keystone . user_list ( IsA ( http . HttpRequest ) , project = self . tenant . id ) . AndReturn ( proj_users ) #NEWLINE# for user in proj_users : #NEWLINE# #INDENT# api . keystone . roles_for_user ( IsA ( http . HttpRequest ) , user . id , self . tenant . id ) . AndReturn ( roles ) #NEWLINE# #UNINDENT# #UNINDENT# api . keystone . role_assignments_list ( IsA ( http . HttpRequest ) , project = self . tenant . id ) . AndReturn ( role_assignments ) #NEWLINE# workflow_data [ ( USER_ROLE_PREFIX + '1' ) ] = [ '1' , '3' ] #NEWLINE# workflow_data [ ( USER_ROLE_PREFIX + '2' ) ] = [ '1' , '2' , '3' ] #NEWLINE# workflow_data [ ( GROUP_ROLE_PREFIX + '1' ) ] = [ '1' , '3' ] #NEWLINE# workflow_data [ ( GROUP_ROLE_PREFIX + '2' ) ] = [ '1' , '2' , '3' ] #NEWLINE# project . _info [ 'domain_id' ] = domain_id #NEWLINE# project . _info [ 'name' ] = 'updated name' #NEWLINE# project . _info [ 'description' ] = 'updated description' #NEWLINE# quota . metadata_items = 444 #NEWLINE# quota . volumes = 444 #NEWLINE# updated_project = { #NEWLINE# #INDENT# 'name' : project . _info [ 'name' ] , #NEWLINE# 'description' : project . _info [ 'description' ] , #NEWLINE# 'enabled' : project . enabled , #NEWLINE# #UNINDENT# } #NEWLINE# updated_quota = self . _get_quota_info ( quota ) #NEWLINE# quotas . tenant_quota_usages ( IsA ( http . HttpRequest ) , tenant_id = project . id ) . AndReturn ( quota_usages ) #NEWLINE# api . keystone . tenant_update ( IsA ( http . HttpRequest ) , project . id , ** updated_project ) . AndReturn ( project ) #NEWLINE# api . keystone . user_list ( IsA ( http . HttpRequest ) , project = self . tenant . id ) . AndReturn ( proj_users ) #NEWLINE# api . keystone . roles_for_user ( IsA ( http . HttpRequest ) , '1' , self . tenant . id ) . AndReturn ( roles ) #NEWLINE# api . keystone . roles_for_user ( IsA ( http . HttpRequest ) , '2' , self . tenant . id ) . AndReturn ( ( roles [ 1 ] , ) ) #NEWLINE# api . keystone . roles_for_user ( IsA ( http . HttpRequest ) , '3' , self . tenant . id ) . AndReturn ( ( roles [ 0 ] , ) ) #NEWLINE# api . keystone . add_tenant_user_role ( IsA ( http . HttpRequest ) , project = self . tenant . id , user = '3' , role = '2' ) . AndRaise ( self . exceptions . keystone ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# project_data = { #NEWLINE# #INDENT# 'domain_id' : project . _info [ 'domain_id' ] , #NEWLINE# 'name' : project . _info [ 'name' ] , #NEWLINE# 'id' : project . id , #NEWLINE# 'description' : project . _info [ 'description' ] , #NEWLINE# 'enabled' : project . enabled , #NEWLINE# #UNINDENT# } #NEWLINE# workflow_data . update ( project_data ) #NEWLINE# workflow_data . update ( updated_quota ) #NEWLINE# url = reverse ( 'horizon:identity:projects:update' , args = [ self . tenant . id ] ) #NEWLINE# res = self . client . post ( url , workflow_data ) #NEWLINE# self . assertNoFormErrors ( res ) #NEWLINE# self . assertMessageCount ( error = 2 , warning = 0 ) #NEWLINE# self . assertRedirectsNoFollow ( res , INDEX_URL )