File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 662662 end
663663
664664 it_behaves_like 'permissions for single object endpoint' , ALL_PERMISSIONS
665+
666+ context 'using username and origin' do
667+ let ( :params ) do
668+ {
669+ username : 'some-user' ,
670+ origin : 'idp.local'
671+ }
672+ end
673+
674+ let ( :user_guid ) { 'new-user-guid' }
675+
676+ let ( :api_call ) { -> ( user_headers ) { post '/v3/users' , params . to_json , user_headers } }
677+
678+ let ( :user_json ) do
679+ {
680+ guid : user_guid ,
681+ created_at : iso8601 ,
682+ updated_at : iso8601 ,
683+ username : params [ :username ] ,
684+ presentation_name : params [ :username ] ,
685+ origin : params [ :origin ] ,
686+ metadata : {
687+ labels : { } ,
688+ annotations : { }
689+ } ,
690+ links : {
691+ self : { href : %r{#{ Regexp . escape ( link_prefix ) } /v3/users/#{ user_guid } } }
692+ }
693+ }
694+ end
695+
696+ let ( :expected_codes_and_responses ) do
697+ h = Hash . new (
698+ code : 403
699+ )
700+ h [ 'admin' ] = {
701+ code : 201 ,
702+ response_object : user_json
703+ }
704+ h
705+ end
706+
707+ before do
708+ allow ( CloudController ::DependencyLocator . instance ) . to receive ( :uaa_shadow_user_creation_client ) . and_return ( uaa_client )
709+ allow ( uaa_client ) . to receive ( :create_shadow_user ) . and_return ( { 'id' => user_guid } )
710+ end
711+
712+ it_behaves_like 'permissions for single object endpoint' , ALL_PERMISSIONS
713+ end
665714 end
666715
667716 describe 'when creating a user that exists in uaa' do
You can’t perform that action at this time.
0 commit comments