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
Léo-Paul Géneau
gitlab-ce
Commits
516d33f5
Commit
516d33f5
authored
Feb 12, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update import API and spec
parent
d3b3f5d1
Changes
2
Hide 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
+2
-2
spec/requests/api/project_import_spec.rb
spec/requests/api/project_import_spec.rb
+5
-3
No files found.
lib/api/project_import.rb
View file @
516d33f5
...
@@ -17,7 +17,7 @@ module API
...
@@ -17,7 +17,7 @@ module API
end
end
params
do
params
do
requires
:
name
,
type:
String
,
desc:
'The new project
name'
requires
:
path
,
type:
String
,
desc:
'The new project path and
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
...
@@ -38,7 +38,7 @@ module API
...
@@ -38,7 +38,7 @@ module API
Namespace
.
find_by_path_or_name
(
namespace
)
Namespace
.
find_by_path_or_name
(
namespace
)
end
end
project_params
=
import_params
.
merge
(
namespace:
namespace
.
id
)
project_params
=
import_params
.
merge
(
namespace
_id
:
namespace
.
id
)
project
=
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
project_params
).
execute
project
=
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
project_params
).
execute
...
...
spec/requests/api/project_import_spec.rb
View file @
516d33f5
...
@@ -8,7 +8,7 @@ describe API::ProjectImport do
...
@@ -8,7 +8,7 @@ describe API::ProjectImport do
before
do
before
do
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
group
.
add_owner
(
user
)
namespace
.
add_owner
(
user
)
end
end
after
do
after
do
...
@@ -19,9 +19,11 @@ describe API::ProjectImport do
...
@@ -19,9 +19,11 @@ describe API::ProjectImport 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
),
name:
'tes
t'
,
file:
file
,
namespace:
namespace
.
full_path
post
api
(
'/projects/import'
,
user
),
path:
'test-impor
t'
,
file:
file
,
namespace:
namespace
.
full_path
expect
(
project
.
status
).
to
eq
(
'started'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
Project
.
find_by_name
(
'test-import'
).
first
.
status
).
to
eq
(
'started'
)
end
end
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