Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9857393

Browse files
abhishekmsinghnejch
authored andcommitted
feat: fix func name, add func test, add docs
1 parent2d5f341 commit9857393

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

‎docs/gl_objects/projects.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,15 @@ Import the project into a namespace and override parameters::
342342
override_params={'visibility': 'private'},
343343
)
344344

345+
Import the project using file stored on a remote URL::
346+
347+
output = gl.projects.remote_import(
348+
url="https://whatever.com/url/file.tar.gz",
349+
path="my_new_remote_project",
350+
name="My New Remote Project",
351+
namespace="my-group",
352+
override_params={'visibility': 'private'},
353+
)
345354

346355
Project custom attributes
347356
=========================

‎gitlab/v4/objects/projects.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ def import_project(
851851
"/projects/import",post_data=data,files=files,**kwargs
852852
)
853853

854-
defimport_project_from_remote(
854+
defremote_import(
855855
self,
856856
url:str,
857857
path:str,

‎tests/functional/api/test_import_export.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
importtime
22

3+
importpytest
4+
35
importgitlab
46

57

@@ -64,3 +66,15 @@ def test_project_import_export(gl, project, temp_dir):
6466
count+=1
6567
ifcount==15:
6668
raiseException("Project import taking too much time")
69+
70+
71+
deftest_project_remote_import(gl):
72+
withpytest.raises(gitlab.exceptions.GitlabHttpError)aserr_info:
73+
gl.projects.remote_import(
74+
"ftp://whatever.com/url","remote-project","remote-project","root"
75+
)
76+
asserterr_info.value.response_code==400
77+
assert (
78+
"File url is blocked: Only allowed schemes are https"
79+
inerr_info.value.error_message
80+
)

‎tests/unit/objects/test_project_import_export.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def resp_import_project():
3030

3131

3232
@pytest.fixture
33-
defresp_import_project_from_remote():
33+
defresp_remote_import():
3434
content= {
3535
"id":1,
3636
"description":None,
@@ -123,8 +123,8 @@ def test_import_project(gl, resp_import_project):
123123
assertproject_import["import_status"]=="scheduled"
124124

125125

126-
deftest_import_project_from_remote(gl,resp_import_project_from_remote):
127-
project_import=gl.projects.import_project_from_remote(
126+
deftest_remote_import(gl,resp_remote_import):
127+
project_import=gl.projects.remote_import(
128128
"https://whatever.com/url","remote-project","remote-project","root"
129129
)
130130
assertproject_import["import_status"]=="scheduled"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp