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
Boxiang Sun
gitlab-ce
Commits
d3b3f5d1
Commit
d3b3f5d1
authored
Feb 12, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update import API and spec
parent
82ff66ef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
lib/api/project_import.rb
lib/api/project_import.rb
+5
-2
spec/requests/api/project_import_spec.rb
spec/requests/api/project_import_spec.rb
+2
-3
No files found.
lib/api/project_import.rb
View file @
d3b3f5d1
...
@@ -17,6 +17,7 @@ module API
...
@@ -17,6 +17,7 @@ module API
end
end
params
do
params
do
requires
:name
,
type:
String
,
desc:
'The new project name'
optional
:namespace
,
type:
String
,
desc:
'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.'
optional
:namespace
,
type:
String
,
desc:
'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.'
requires
:file
,
type:
File
,
desc:
'The project export file to be imported'
requires
:file
,
type:
File
,
desc:
'The project export file to be imported'
end
end
...
@@ -37,9 +38,11 @@ module API
...
@@ -37,9 +38,11 @@ module API
Namespace
.
find_by_path_or_name
(
namespace
)
Namespace
.
find_by_path_or_name
(
namespace
)
end
end
project
=
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
import_params
).
execute
project
_params
=
import_params
.
merge
(
namespace:
namespace
.
id
)
render_api_error!
(
link
.
project
.
full_messages
.
first
,
400
)
unless
project
.
saved?
project
=
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
project_params
).
execute
render_api_error!
(
project
.
full_messages
.
first
,
400
)
unless
project
.
saved?
present
project
,
with:
Entities
::
ProjectImportStatus
present
project
,
with:
Entities
::
ProjectImportStatus
end
end
...
...
spec/requests/api/project_import_spec.rb
View file @
d3b3f5d1
...
@@ -16,11 +16,10 @@ describe API::ProjectImport do
...
@@ -16,11 +16,10 @@ describe API::ProjectImport do
end
end
describe
'POST /projects/import'
do
describe
'POST /projects/import'
do
it
'schedules an import'
do
it
'schedules an import'
do
expect_any_instance_of
(
Project
).
to
receive
(
:import_schedule
)
expect_any_instance_of
(
Project
).
to
receive
(
:import_schedule
)
post
api
(
'/projects/import'
,
user
),
file:
file
,
namespace:
namespace
.
full_path
post
api
(
'/projects/import'
,
user
),
name:
'test'
,
file:
file
,
namespace:
namespace
.
full_path
expect
(
project
.
status
).
to
eq
(
'started'
)
expect
(
project
.
status
).
to
eq
(
'started'
)
end
end
...
...
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