commit
d6a5e3dad7
5 changed files with 17 additions and 20 deletions
|
@ -28,7 +28,7 @@ v 3.0.0
|
||||||
- Reject ssh keys that break gitolite
|
- Reject ssh keys that break gitolite
|
||||||
- [API] list one project hook
|
- [API] list one project hook
|
||||||
- [API] edit project hook
|
- [API] edit project hook
|
||||||
- [API] add project snippets list
|
- [API] list project snippets
|
||||||
- [API] allow to authorize using private token in HTTP header
|
- [API] allow to authorize using private token in HTTP header
|
||||||
- [API] add user creation
|
- [API] add user creation
|
||||||
|
|
||||||
|
|
|
@ -74,14 +74,12 @@ POST /users
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
+ `email` (required) - Email
|
+ `email` (required) - Email
|
||||||
+ `name` (required) - Name
|
|
||||||
+ `password` (required) - Password
|
+ `password` (required) - Password
|
||||||
+ `password_confirmation` (required) - Password confirmation
|
+ `name` - Name
|
||||||
+ `skype` - Skype ID
|
+ `skype` - Skype ID
|
||||||
+ `linkedin` - Linkedin
|
+ `linkedin` - Linkedin
|
||||||
+ `twitter` - Twitter account
|
+ `twitter` - Twitter account
|
||||||
+ `projects_limit` - Limit projects wich user can create
|
+ `projects_limit` - Number of projects user can create
|
||||||
|
|
||||||
|
|
||||||
Will return created user with status `201 Created` on success, or `404 Not
|
Will return created user with status `201 Created` on success, or `404 Not
|
||||||
found` on fail.
|
found` on fail.
|
||||||
|
|
|
@ -28,19 +28,18 @@ module Gitlab
|
||||||
#
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
# email (required) - Email
|
# email (required) - Email
|
||||||
# name (required) - Name
|
|
||||||
# password (required) - Password
|
# password (required) - Password
|
||||||
# password_confirmation (required) - Password confirmation
|
# name - Name
|
||||||
# skype - Skype ID
|
# skype - Skype ID
|
||||||
# linkedin - Linkedin
|
# linkedin - Linkedin
|
||||||
# twitter - Twitter account
|
# twitter - Twitter account
|
||||||
# projects_limit - Limit projects wich user can create
|
# projects_limit - Number of projects user can create
|
||||||
# Example Request:
|
# Example Request:
|
||||||
# POST /users
|
# POST /users
|
||||||
post do
|
post do
|
||||||
authenticated_as_admin!
|
authenticated_as_admin!
|
||||||
attrs = attributes_for_keys [:email, :name, :password, :password_confirmation, :skype, :linkedin, :twitter, :projects_limit]
|
attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit]
|
||||||
user = User.new attrs
|
user = User.new attrs, as: :admin
|
||||||
if user.save
|
if user.save
|
||||||
present user, with: Entities::User
|
present user, with: Entities::User
|
||||||
else
|
else
|
||||||
|
|
|
@ -46,7 +46,7 @@ describe Gitlab::API do
|
||||||
response.status.should == 201
|
response.status.should == 201
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should repsond with 404 on failure" do
|
it "should respond with 404 on failure" do
|
||||||
post api("/projects", user)
|
post api("/projects", user)
|
||||||
response.status.should == 404
|
response.status.should == 404
|
||||||
end
|
end
|
||||||
|
@ -192,9 +192,9 @@ describe Gitlab::API do
|
||||||
describe "PUT /projects/:id/hooks/:hook_id" do
|
describe "PUT /projects/:id/hooks/:hook_id" do
|
||||||
it "should update an existing project hook" do
|
it "should update an existing project hook" do
|
||||||
put api("/projects/#{project.code}/hooks/#{hook.id}", user),
|
put api("/projects/#{project.code}/hooks/#{hook.id}", user),
|
||||||
url: 'http://example.com'
|
url: 'http://example.org'
|
||||||
response.status.should == 200
|
response.status.should == 200
|
||||||
json_response['url'].should == 'http://example.com'
|
json_response['url'].should == 'http://example.org'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe Gitlab::API do
|
||||||
|
|
||||||
it "should create user" do
|
it "should create user" do
|
||||||
expect {
|
expect {
|
||||||
post api("/users", admin), Factory.attributes(:user)
|
post api("/users", admin), Factory.attributes(:user, projects_limit: 3)
|
||||||
}.to change { User.count }.by(1)
|
}.to change { User.count }.by(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue