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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d8dfec0f
Commit
d8dfec0f
authored
Feb 16, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix project import API after import service refactor
parent
46d59a5d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
lib/api/project_import.rb
lib/api/project_import.rb
+6
-2
spec/requests/api/project_import_spec.rb
spec/requests/api/project_import_spec.rb
+2
-2
No files found.
lib/api/project_import.rb
View file @
d8dfec0f
...
@@ -41,8 +41,12 @@ module API
...
@@ -41,8 +41,12 @@ module API
current_user
.
namespace
current_user
.
namespace
end
end
project_params
=
import_params
.
merge
(
namespace_id:
namespace
.
id
,
project_params
=
{
file:
import_params
[
:file
][
'tempfile'
])
path:
import_params
[
:path
],
namespace_id:
namespace
.
id
,
file:
import_params
[
:file
][
'tempfile'
]
}
project
=
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
project_params
).
execute
project
=
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
project_params
).
execute
render_api_error!
(
project
.
errors
.
full_messages
&
.
first
,
400
)
unless
project
.
saved?
render_api_error!
(
project
.
errors
.
full_messages
&
.
first
,
400
)
unless
project
.
saved?
...
...
spec/requests/api/project_import_spec.rb
View file @
d8dfec0f
...
@@ -42,7 +42,7 @@ describe API::ProjectImport do
...
@@ -42,7 +42,7 @@ describe API::ProjectImport do
it
'schedules an import at the user namespace level'
do
it
'schedules an import at the user namespace level'
do
expect_any_instance_of
(
Project
).
not_to
receive
(
:import_schedule
)
expect_any_instance_of
(
Project
).
not_to
receive
(
:import_schedule
)
expect
(
Gitlab
::
ImportExport
::
ProjectCreator
).
not_to
receive
(
:new
)
expect
(
::
Projects
::
CreateService
).
not_to
receive
(
:new
)
post
api
(
'/projects/import'
,
user
),
namespace:
'nonexistent'
,
path:
'test-import2'
,
file:
fixture_file_upload
(
file
)
post
api
(
'/projects/import'
,
user
),
namespace:
'nonexistent'
,
path:
'test-import2'
,
file:
fixture_file_upload
(
file
)
...
@@ -73,7 +73,7 @@ describe API::ProjectImport do
...
@@ -73,7 +73,7 @@ describe API::ProjectImport do
def
stub_import
(
namespace
)
def
stub_import
(
namespace
)
expect_any_instance_of
(
Project
).
to
receive
(
:import_schedule
)
expect_any_instance_of
(
Project
).
to
receive
(
:import_schedule
)
expect
(
Gitlab
::
ImportExport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
namespace
.
id
,
any_args
).
and_call_original
expect
(
::
Projects
::
CreateService
).
to
receive
(
:new
).
with
(
user
,
hash_including
(
namespace_id:
namespace
.
id
)
).
and_call_original
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