Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
c2516115
Commit
c2516115
authored
Jun 01, 2017
by
Robin Bobbitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose import_status in Projects API
parent
0218a0bd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
0 deletions
+37
-0
changelogs/unreleased/projects-api-import-status.yml
changelogs/unreleased/projects-api-import-status.yml
+4
-0
doc/api/projects.md
doc/api/projects.md
+11
-0
lib/api/entities.rb
lib/api/entities.rb
+2
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+20
-0
No files found.
changelogs/unreleased/projects-api-import-status.yml
0 → 100644
View file @
c2516115
---
title
:
Expose import_status in Projects API
merge_request
:
11851
author
:
Robin Bobbitt
doc/api/projects.md
View file @
c2516115
...
@@ -81,6 +81,7 @@ Parameters:
...
@@ -81,6 +81,7 @@ Parameters:
"kind"
:
"group"
,
"kind"
:
"group"
,
"full_path"
:
"diaspora"
"full_path"
:
"diaspora"
},
},
"import_status"
:
"none"
,
"archived"
:
false
,
"archived"
:
false
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/4/uploads/avatar.png"
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/4/uploads/avatar.png"
,
"shared_runners_enabled"
:
true
,
"shared_runners_enabled"
:
true
,
...
@@ -138,6 +139,8 @@ Parameters:
...
@@ -138,6 +139,8 @@ Parameters:
"kind"
:
"group"
,
"kind"
:
"group"
,
"full_path"
:
"brightbox"
"full_path"
:
"brightbox"
},
},
"import_status"
:
"none"
,
"import_error"
:
null
,
"permissions"
:
{
"permissions"
:
{
"project_access"
:
{
"project_access"
:
{
"access_level"
:
10
,
"access_level"
:
10
,
...
@@ -225,6 +228,8 @@ Parameters:
...
@@ -225,6 +228,8 @@ Parameters:
"kind"
:
"group"
,
"kind"
:
"group"
,
"full_path"
:
"diaspora"
"full_path"
:
"diaspora"
},
},
"import_status"
:
"none"
,
"import_error"
:
null
,
"permissions"
:
{
"permissions"
:
{
"project_access"
:
{
"project_access"
:
{
"access_level"
:
10
,
"access_level"
:
10
,
...
@@ -611,6 +616,7 @@ Example response:
...
@@ -611,6 +616,7 @@ Example response:
"kind"
:
"group"
,
"kind"
:
"group"
,
"full_path"
:
"diaspora"
"full_path"
:
"diaspora"
},
},
"import_status"
:
"none"
,
"archived"
:
true
,
"archived"
:
true
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
"shared_runners_enabled"
:
true
,
"shared_runners_enabled"
:
true
,
...
@@ -676,6 +682,7 @@ Example response:
...
@@ -676,6 +682,7 @@ Example response:
"kind"
:
"group"
,
"kind"
:
"group"
,
"full_path"
:
"diaspora"
"full_path"
:
"diaspora"
},
},
"import_status"
:
"none"
,
"archived"
:
true
,
"archived"
:
true
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
"shared_runners_enabled"
:
true
,
"shared_runners_enabled"
:
true
,
...
@@ -747,6 +754,8 @@ Example response:
...
@@ -747,6 +754,8 @@ Example response:
"kind"
:
"group"
,
"kind"
:
"group"
,
"full_path"
:
"diaspora"
"full_path"
:
"diaspora"
},
},
"import_status"
:
"none"
,
"import_error"
:
null
,
"permissions"
:
{
"permissions"
:
{
"project_access"
:
{
"project_access"
:
{
"access_level"
:
10
,
"access_level"
:
10
,
...
@@ -829,6 +838,8 @@ Example response:
...
@@ -829,6 +838,8 @@ Example response:
"kind"
:
"group"
,
"kind"
:
"group"
,
"full_path"
:
"diaspora"
"full_path"
:
"diaspora"
},
},
"import_status"
:
"none"
,
"import_error"
:
null
,
"permissions"
:
{
"permissions"
:
{
"project_access"
:
{
"project_access"
:
{
"access_level"
:
10
,
"access_level"
:
10
,
...
...
lib/api/entities.rb
View file @
c2516115
...
@@ -100,6 +100,8 @@ module API
...
@@ -100,6 +100,8 @@ module API
expose
:creator_id
expose
:creator_id
expose
:namespace
,
using:
'API::Entities::Namespace'
expose
:namespace
,
using:
'API::Entities::Namespace'
expose
:forked_from_project
,
using:
Entities
::
BasicProjectDetails
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:forked_from_project
,
using:
Entities
::
BasicProjectDetails
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:import_status
expose
:import_error
,
if:
lambda
{
|
_project
,
options
|
options
[
:user_can_admin_project
]
}
expose
:avatar_url
do
|
user
,
options
|
expose
:avatar_url
do
|
user
,
options
|
user
.
avatar_url
(
only_path:
false
)
user
.
avatar_url
(
only_path:
false
)
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
c2516115
...
@@ -619,6 +619,8 @@ describe API::Projects do
...
@@ -619,6 +619,8 @@ describe API::Projects do
expect
(
json_response
[
'shared_runners_enabled'
]).
to
be_present
expect
(
json_response
[
'shared_runners_enabled'
]).
to
be_present
expect
(
json_response
[
'creator_id'
]).
to
be_present
expect
(
json_response
[
'creator_id'
]).
to
be_present
expect
(
json_response
[
'namespace'
]).
to
be_present
expect
(
json_response
[
'namespace'
]).
to
be_present
expect
(
json_response
[
'import_status'
]).
to
be_present
expect
(
json_response
).
to
include
(
"import_error"
)
expect
(
json_response
[
'avatar_url'
]).
to
be_nil
expect
(
json_response
[
'avatar_url'
]).
to
be_nil
expect
(
json_response
[
'star_count'
]).
to
be_present
expect
(
json_response
[
'star_count'
]).
to
be_present
expect
(
json_response
[
'forks_count'
]).
to
be_present
expect
(
json_response
[
'forks_count'
]).
to
be_present
...
@@ -686,6 +688,20 @@ describe API::Projects do
...
@@ -686,6 +688,20 @@ describe API::Projects do
expect
(
json_response
).
to
include
'statistics'
expect
(
json_response
).
to
include
'statistics'
end
end
it
"includes import_error if user can admin project"
do
get
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
include
(
"import_error"
)
end
it
"does not include import_error if user cannot admin project"
do
get
api
(
"/projects/
#{
project
.
id
}
"
,
user3
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
not_to
include
(
"import_error"
)
end
describe
'permissions'
do
describe
'permissions'
do
context
'all projects'
do
context
'all projects'
do
before
{
project
.
team
<<
[
user
,
:master
]
}
before
{
project
.
team
<<
[
user
,
:master
]
}
...
@@ -1448,6 +1464,8 @@ describe API::Projects do
...
@@ -1448,6 +1464,8 @@ describe API::Projects do
expect
(
json_response
[
'owner'
][
'id'
]).
to
eq
(
user2
.
id
)
expect
(
json_response
[
'owner'
][
'id'
]).
to
eq
(
user2
.
id
)
expect
(
json_response
[
'namespace'
][
'id'
]).
to
eq
(
user2
.
namespace
.
id
)
expect
(
json_response
[
'namespace'
][
'id'
]).
to
eq
(
user2
.
namespace
.
id
)
expect
(
json_response
[
'forked_from_project'
][
'id'
]).
to
eq
(
project
.
id
)
expect
(
json_response
[
'forked_from_project'
][
'id'
]).
to
eq
(
project
.
id
)
expect
(
json_response
[
'import_status'
]).
to
eq
(
'started'
)
expect
(
json_response
).
to
include
(
"import_error"
)
end
end
it
'forks if user is admin'
do
it
'forks if user is admin'
do
...
@@ -1459,6 +1477,8 @@ describe API::Projects do
...
@@ -1459,6 +1477,8 @@ describe API::Projects do
expect
(
json_response
[
'owner'
][
'id'
]).
to
eq
(
admin
.
id
)
expect
(
json_response
[
'owner'
][
'id'
]).
to
eq
(
admin
.
id
)
expect
(
json_response
[
'namespace'
][
'id'
]).
to
eq
(
admin
.
namespace
.
id
)
expect
(
json_response
[
'namespace'
][
'id'
]).
to
eq
(
admin
.
namespace
.
id
)
expect
(
json_response
[
'forked_from_project'
][
'id'
]).
to
eq
(
project
.
id
)
expect
(
json_response
[
'forked_from_project'
][
'id'
]).
to
eq
(
project
.
id
)
expect
(
json_response
[
'import_status'
]).
to
eq
(
'started'
)
expect
(
json_response
).
to
include
(
"import_error"
)
end
end
it
'fails on missing project access for the project to fork'
do
it
'fails on missing project access for the project to fork'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment