File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ def validate(record)
1313 elsif record . username || record . origin
1414 record . errors . add ( :origin , message : "'username' is missing" ) unless record . username
1515 record . errors . add ( :username , message : "'origin' is missing" ) unless record . origin
16+ record . errors . add ( :origin , message : "cannot be 'uaa' when creating a user by username" ) unless record . origin != 'uaa'
1617 else
1718 record . errors . add ( :guid , message : "either 'guid' or 'username' and 'origin' must be provided" )
1819 end
Original file line number Diff line number Diff line change @@ -150,6 +150,17 @@ module VCAP::CloudController
150150 expect ( subject . errors [ :origin ] ) . to include ( "'username' is missing" )
151151 end
152152 end
153+
154+ context 'when equal to "uaa"' do
155+ let ( :params ) do
156+ { origin : 'uaa' }
157+ end
158+
159+ it 'is not valid' do
160+ expect ( subject ) . not_to be_valid
161+ expect ( subject . errors [ :origin ] ) . to include ( "cannot be 'uaa' when creating a user by username" )
162+ end
163+ end
153164 end
154165 end
155166 end
You can’t perform that action at this time.
0 commit comments