#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . keystone : ( 'tenant_create' , 'user_list' , 'role_list' , 'group_list' , 'get_default_domain' , 'get_default_role' , 'add_tenant_user_role' ) , #NEWLINE# quotas : ( 'get_default_quota_data' , 'get_disabled_quotas' , 'tenant_quota_usages' ) , #NEWLINE# api . nova : ( 'tenant_quota_update' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_add_project_quota_update_error( self ) : #NEWLINE# #INDENT# project = self . tenants . first ( ) #NEWLINE# quota = self . quotas . first ( ) #NEWLINE# default_role = self . roles . first ( ) #NEWLINE# default_domain = self . _get_default_domain ( ) #NEWLINE# domain_id = default_domain . id #NEWLINE# users = self . _get_all_users ( domain_id ) #NEWLINE# groups = self . _get_all_groups ( domain_id ) #NEWLINE# roles = self . roles . list ( ) #NEWLINE# api . keystone . get_default_domain ( IsA ( http . HttpRequest ) ) . AndReturn ( default_domain ) #NEWLINE# quotas . get_disabled_quotas ( IsA ( http . HttpRequest ) ) . AndReturn ( self . disabled_quotas . first ( ) ) #NEWLINE# quotas . get_default_quota_data ( IsA ( http . HttpRequest ) ) . 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# project_details = self . _get_project_info ( project ) #NEWLINE# quota_data = self . _get_quota_info ( quota ) #NEWLINE# api . keystone . tenant_create ( IsA ( http . HttpRequest ) , ** project_details ) . AndReturn ( project ) #NEWLINE# workflow_data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for role in roles : #NEWLINE# #INDENT# if ( ( USER_ROLE_PREFIX + role . id ) in workflow_data ) : #NEWLINE# #INDENT# ulist = workflow_data [ ( USER_ROLE_PREFIX + role . id ) ] #NEWLINE# for user_id in ulist : #NEWLINE# #INDENT# api . keystone . add_tenant_user_role ( IsA ( http . HttpRequest ) , project = self . tenant . id , user = user_id , role = role . id ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for role in roles : #NEWLINE# #INDENT# if ( ( GROUP_ROLE_PREFIX + role . id ) in workflow_data ) : #NEWLINE# #INDENT# ulist = workflow_data [ ( GROUP_ROLE_PREFIX + role . id ) ] #NEWLINE# for group_id in ulist : #NEWLINE# #INDENT# api . keystone . add_group_role ( IsA ( http . HttpRequest ) , role = role . id , group = group_id , project = self . tenant . id ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# nova_updated_quota = dict ( [ ( key , quota_data [ key ] ) for key in quotas . NOVA_QUOTA_FIELDS ] ) #NEWLINE# api . nova . tenant_quota_update ( IsA ( http . HttpRequest ) , project . id , ** nova_updated_quota ) . AndRaise ( self . exceptions . nova ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# workflow_data . update ( self . _get_workflow_data ( project , quota ) ) #NEWLINE# url = reverse ( 'horizon:identity:projects:create' ) #NEWLINE# res = self . client . post ( url , workflow_data ) #NEWLINE# self . assertNoFormErrors ( res ) #NEWLINE# self . assertRedirectsNoFollow ( res , INDEX_URL )