#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . keystone : ( 'get_default_domain' , 'get_default_role' , 'user_list' , 'group_list' , 'role_list' ) , #NEWLINE# api . base : ( 'is_service_enabled' , ) , #NEWLINE# api . neutron : ( 'is_extension_supported' , ) , #NEWLINE# quotas : ( 'get_default_quota_data' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_add_project_get( self ) : #NEWLINE# #INDENT# 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 . base . is_service_enabled ( IsA ( http . HttpRequest ) , 'network' ) . MultipleTimes ( ) . AndReturn ( True ) #NEWLINE# api . base . is_service_enabled ( IsA ( http . HttpRequest ) , 'volume' ) . MultipleTimes ( ) . AndReturn ( True ) #NEWLINE# api . keystone . get_default_domain ( IsA ( http . HttpRequest ) ) . AndReturn ( default_domain ) #NEWLINE# api . neutron . is_extension_supported ( IsA ( http . HttpRequest ) , 'security-group' ) . AndReturn ( True ) #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 ) ) . AndReturn ( roles ) #NEWLINE# api . keystone . group_list ( IsA ( http . HttpRequest ) , domain = domain_id ) . AndReturn ( groups ) #NEWLINE# api . keystone . role_list ( IsA ( http . HttpRequest ) ) . AndReturn ( roles ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# url = reverse ( 'horizon:admin:projects:create' ) #NEWLINE# res = self . client . get ( url ) #NEWLINE# self . assertTemplateUsed ( res , views . WorkflowView . template_name ) #NEWLINE# self . assertContains ( res , '<input type="hidden" name="subnet" id="id_subnet" />' , html = True ) #NEWLINE# workflow = res . context [ 'workflow' ] #NEWLINE# self . assertEqual ( domain_id . context [ 'workflow' ] . name , workflows . CreateProject . name ) #NEWLINE# step = workflow . get_step ( 'createprojectinfoaction' ) #NEWLINE# self . assertEqual ( step . action . initial [ 'ram' ] , quota . get ( 'ram' ) . limit ) #NEWLINE# self . assertEqual ( step . action . initial [ 'injected_files' ] , quota . get ( 'injected_files' ) . limit ) #NEWLINE# self . assertQuerysetEqual ( workflow . steps , [ '<CreateProjectInfo: createprojectinfoaction>' , '<UpdateProjectMembers: update_members>' , '<UpdateProjectGroups: update_group_members>' , '<UpdateProjectQuota: update_quotas>' ] )