summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorAbhishek Singh <abhiandthetruth@gmail.com>2022-11-01 15:10:04 +0530
committerGitHub <noreply@github.com>2022-11-01 10:40:04 +0100
commite5dc72de9b3cdf0a7944ee0961fbdc6784c7f315 (patch)
tree324550c485d554c5b41f234bc4ea811ac8f445e4 /tests/unit
parent31ec1469211875a9c2b16b4d891a8b7fe1043af1 (diff)
downloadgitlab-e5dc72de9b3cdf0a7944ee0961fbdc6784c7f315.tar.gz
feat(api): add support for remote project import (#2348)
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/objects/test_project_import_export.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unit/objects/test_project_import_export.py b/tests/unit/objects/test_project_import_export.py
index 450acc0..72321ec 100644
--- a/tests/unit/objects/test_project_import_export.py
+++ b/tests/unit/objects/test_project_import_export.py
@@ -30,6 +30,30 @@ def resp_import_project():
@pytest.fixture
+def resp_remote_import():
+ content = {
+ "id": 1,
+ "description": None,
+ "name": "remote-project",
+ "name_with_namespace": "Administrator / remote-project",
+ "path": "remote-project",
+ "path_with_namespace": "root/remote-project",
+ "created_at": "2018-02-13T09:05:58.023Z",
+ "import_status": "scheduled",
+ }
+
+ with responses.RequestsMock() as rsps:
+ rsps.add(
+ method=responses.POST,
+ url="http://localhost/api/v4/projects/remote-import",
+ json=content,
+ content_type="application/json",
+ status=200,
+ )
+ yield rsps
+
+
+@pytest.fixture
def resp_import_status():
content = {
"id": 1,
@@ -99,6 +123,13 @@ def test_import_project(gl, resp_import_project):
assert project_import["import_status"] == "scheduled"
+def test_remote_import(gl, resp_remote_import):
+ project_import = gl.projects.remote_import(
+ "https://whatever.com/url", "remote-project", "remote-project", "root"
+ )
+ assert project_import["import_status"] == "scheduled"
+
+
def test_import_project_with_override_params(gl, resp_import_project):
project_import = gl.projects.import_project(
"file", "api-project", override_params={"visibility": "private"}