Skip to content
Snippets Groups Projects

user creation api extension: Added temp password feature from admin ui into users api call

Closed gitlab-qa-bot requested to merge github/fork/duk3luk3/useradd-api-extension into master
1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
  • 24622941
    Several tests for the /user api call were succeeding for the wrong reason.
    The tests were all missing required parameters, so the api would return
    an error because of that and not because of the specific condition
    intended to be tested.
    
    Also fixed a small typo.
@@ -71,26 +71,26 @@ describe API::API do
end
it "should not create user with invalid email" do
post api("/users", admin), { email: "invalid email", password: 'password' }
post api("/users", admin), { email: "invalid email", password: 'password', name: "T. User", username: "testuser" }
response.status.should == 400
end
it "should return 400 error if password or force_random_password not given" do
post api("/users", admin), { email: 'test@example.com' }
post api("/users", admin), { email: 'test@example.com', name: "T. User", username: "testuser" }
response.status.should == 400
end
it "should return 400 error if both password and force_random_password are set" do
post api("/users", admin), { password: 'password', force_random_password: '1' }
post api("/users", admin), { password: 'password', force_random_password: '1', email: 'test@example.com', name: "T. User", username: "testuser" }
response.status.should == 400
end
it "should return 400 error if email not given" do
post api("/users", admin), { password: 'pass1234' }
post api("/users", admin), { password: 'pass1234', name: "T. User", username: "testuser" }
response.status.should == 400
end
it "shouldn't available for non admin users" do
it "shouldn't be available for non admin users" do
post api("/users", user), attributes_for(:user)
response.status.should == 403
end
Loading