From 915587f72de85b45880a2f1d50bdae1a61eb2638 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sun, 8 Mar 2020 10:46:56 +0100 Subject: [PATCH 1/8] test: prepare base project test class for more tests --- gitlab/tests/objects/test_projects.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gitlab/tests/objects/test_projects.py b/gitlab/tests/objects/test_projects.py index 237a9bee7..3f61f72bc 100644 --- a/gitlab/tests/objects/test_projects.py +++ b/gitlab/tests/objects/test_projects.py @@ -14,7 +14,9 @@ headers = {"content-type": "application/json"} -class TestProjectSnippets(unittest.TestCase): +class TestProject(unittest.TestCase): + """Base class for GitLab Project tests""" + def setUp(self): self.gl = Gitlab( "http://localhost", @@ -22,7 +24,10 @@ def setUp(self): ssl_verify=True, api_version=4, ) + self.project = self.gl.projects.get(1, lazy=True) + +class TestProjectSnippets(TestProject): def test_list_project_snippets(self): title = "Example Snippet Title" visibility = "private" @@ -47,7 +52,7 @@ def resp_list_snippet(url, request): return response(200, content, headers, None, 25, request) with HTTMock(resp_list_snippet): - snippets = self.gl.projects.get(1, lazy=True).snippets.list() + snippets = self.project.snippets.list() self.assertEqual(len(snippets), 1) self.assertEqual(snippets[0].title, title) self.assertEqual(snippets[0].visibility, visibility) @@ -76,7 +81,7 @@ def resp_get_snippet(url, request): return response(200, content, headers, None, 25, request) with HTTMock(resp_get_snippet): - snippet = self.gl.projects.get(1, lazy=True).snippets.get(1) + snippet = self.project.snippets.get(1) self.assertEqual(snippet.title, title) self.assertEqual(snippet.visibility, visibility) @@ -123,7 +128,7 @@ def resp_create_snippet(url, request): return response(200, content, headers, None, 25, request) with HTTMock(resp_create_snippet, resp_update_snippet): - snippet = self.gl.projects.get(1, lazy=True).snippets.create( + snippet = self.project.snippets.create( { "title": title, "file_name": title, From 600dc86f34b6728b37a98b44e6aba73044bf3191 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sun, 8 Mar 2020 13:49:00 +0100 Subject: [PATCH 2/8] test: add unit tests for Project Export --- gitlab/tests/objects/test_projects.py | 71 ++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/gitlab/tests/objects/test_projects.py b/gitlab/tests/objects/test_projects.py index 3f61f72bc..7fb51b5bf 100644 --- a/gitlab/tests/objects/test_projects.py +++ b/gitlab/tests/objects/test_projects.py @@ -8,10 +8,11 @@ import requests from gitlab import * # noqa from gitlab.v4.objects import * # noqa -from httmock import HTTMock, urlmatch, response # noqa +from httmock import HTTMock, urlmatch, response, with_httmock # noqa headers = {"content-type": "application/json"} +binary_content = b"binary content" class TestProject(unittest.TestCase): @@ -143,3 +144,71 @@ def resp_create_snippet(url, request): snippet.save() self.assertEqual(snippet.title, title) self.assertEqual(snippet.visibility, visibility) + + +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/projects/1/export", method="post", +) +def resp_create_export(url, request): + """Common mock for Project Export tests""" + content = """{ + "message": "202 Accepted" + }""" + content = content.encode("utf-8") + return response(202, content, headers, None, 25, request) + + +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/projects/1/export", method="get", +) +def resp_export_status(url, request): + """mock for Project Export GET response""" + content = """{ + "id": 1, + "description": "Itaque perspiciatis minima aspernatur", + "name": "Gitlab Test", + "name_with_namespace": "Gitlab Org / Gitlab Test", + "path": "gitlab-test", + "path_with_namespace": "gitlab-org/gitlab-test", + "created_at": "2017-08-29T04:36:44.383Z", + "export_status": "finished", + "_links": { + "api_url": "https://gitlab.test/api/v4/projects/1/export/download", + "web_url": "https://gitlab.test/gitlab-test/download_export" + } + } + """ + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + +@urlmatch( + scheme="http", + netloc="localhost", + path="/api/v4/projects/1/export/download", + method="get", +) +def resp_download_export(url, request): + headers = {"content-type": "application/octet-stream"} + content = binary_content + return response(200, content, headers, None, 25, request) + + +class TestProjectExport(TestProject): + @with_httmock(resp_create_export) + def test_create_project_export(self): + export = self.project.exports.create() + self.assertEqual(export.message, "202 Accepted") + + @with_httmock(resp_create_export, resp_export_status) + def test_refresh_project_export_status(self): + export = self.project.exports.create() + export.refresh() + self.assertEqual(export.export_status, "finished") + + @with_httmock(resp_create_export, resp_download_export) + def test_download_project_export(self): + export = self.project.exports.create() + download = export.download() + self.assertIsInstance(download, bytes) + self.assertEqual(download, binary_content) From f7aad5f78c49ad1a4e05a393bcf236b7bbad2f2a Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sun, 8 Mar 2020 18:30:03 +0100 Subject: [PATCH 3/8] test: add unit tests for Project Import --- gitlab/tests/objects/test_projects.py | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/gitlab/tests/objects/test_projects.py b/gitlab/tests/objects/test_projects.py index 7fb51b5bf..010ce0454 100644 --- a/gitlab/tests/objects/test_projects.py +++ b/gitlab/tests/objects/test_projects.py @@ -212,3 +212,56 @@ def test_download_project_export(self): download = export.download() self.assertIsInstance(download, bytes) self.assertEqual(download, binary_content) + + +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/projects/import", method="post", +) +def resp_import_project(url, request): + """Mock for Project Import POST response""" + content = """{ + "id": 1, + "description": null, + "name": "api-project", + "name_with_namespace": "Administrator / api-project", + "path": "api-project", + "path_with_namespace": "root/api-project", + "created_at": "2018-02-13T09:05:58.023Z", + "import_status": "scheduled" + }""" + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/projects/1/import", method="get", +) +def resp_import_status(url, request): + """Mock for Project Import GET response""" + content = """{ + "id": 1, + "description": "Itaque perspiciatis minima aspernatur corporis consequatur.", + "name": "Gitlab Test", + "name_with_namespace": "Gitlab Org / Gitlab Test", + "path": "gitlab-test", + "path_with_namespace": "gitlab-org/gitlab-test", + "created_at": "2017-08-29T04:36:44.383Z", + "import_status": "finished" + }""" + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + +class TestProjectImport(TestProject): + # import_github is tested in test_gitlab.py + + @with_httmock(resp_import_project) + def test_import_project(self): + project_import = self.gl.projects.import_project("file", "api-project") + self.assertEqual(project_import["import_status"], "scheduled") + + @with_httmock(resp_import_project, resp_import_status) + def test_refresh_project_import_status(self): + project_import = self.project.imports.get() + project_import.refresh() + self.assertEqual(project_import.import_status, "finished") From a881fb71eebf744bcbe232869f622ea8a3ac975f Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sun, 8 Mar 2020 18:33:07 +0100 Subject: [PATCH 4/8] chore: move test_import_github into TestProjectImport --- gitlab/tests/objects/test_projects.py | 29 +++++++++++++++++++++++++-- gitlab/tests/test_gitlab.py | 27 ------------------------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/gitlab/tests/objects/test_projects.py b/gitlab/tests/objects/test_projects.py index 010ce0454..93dadd0e2 100644 --- a/gitlab/tests/objects/test_projects.py +++ b/gitlab/tests/objects/test_projects.py @@ -253,8 +253,6 @@ def resp_import_status(url, request): class TestProjectImport(TestProject): - # import_github is tested in test_gitlab.py - @with_httmock(resp_import_project) def test_import_project(self): project_import = self.gl.projects.import_project("file", "api-project") @@ -265,3 +263,30 @@ def test_refresh_project_import_status(self): project_import = self.project.imports.get() project_import.refresh() self.assertEqual(project_import.import_status, "finished") + + def test_import_github(self): + @urlmatch( + scheme="http", + netloc="localhost", + path="/api/v4/import/github", + method="post", + ) + def resp_import_github(url, request): + headers = {"content-type": "application/json"} + content = """{ + "id": 27, + "name": "my-repo", + "full_path": "/root/my-repo", + "full_name": "Administrator / my-repo" + }""" + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + with HTTMock(resp_import_github): + base_path = "/root" + name = "my-repo" + ret = self.gl.projects.import_github("githubkey", 1234, base_path, name) + self.assertIsInstance(ret, dict) + self.assertEqual(ret["name"], name) + self.assertEqual(ret["full_path"], "/".join((base_path, name))) + self.assertTrue(ret["full_name"].endswith(name)) diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py index 249d0c50d..591f166ec 100644 --- a/gitlab/tests/test_gitlab.py +++ b/gitlab/tests/test_gitlab.py @@ -937,33 +937,6 @@ def resp_update_submodule(url, request): self.assertEqual(ret["message"], "Message") self.assertEqual(ret["id"], "ed899a2f4b50b4370feeea94676502b42383c746") - def test_import_github(self): - @urlmatch( - scheme="http", - netloc="localhost", - path="/api/v4/import/github", - method="post", - ) - def resp_import_github(url, request): - headers = {"content-type": "application/json"} - content = """{ - "id": 27, - "name": "my-repo", - "full_path": "/root/my-repo", - "full_name": "Administrator / my-repo" - }""" - content = content.encode("utf-8") - return response(200, content, headers, None, 25, request) - - with HTTMock(resp_import_github): - base_path = "/root" - name = "my-repo" - ret = self.gl.projects.import_github("githubkey", 1234, base_path, name) - self.assertIsInstance(ret, dict) - self.assertEqual(ret["name"], name) - self.assertEqual(ret["full_path"], "/".join((base_path, name))) - self.assertTrue(ret["full_name"].endswith(name)) - def test_applications(self): content = '{"name": "test_app", "redirect_uri": "http://localhost:8080", "scopes": ["api", "email"]}' json_content = json.loads(content) From b8ea96cc20519b751631b27941d60c486aa4188c Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sun, 8 Mar 2020 18:37:34 +0100 Subject: [PATCH 5/8] chore: flatten test_import_github --- gitlab/tests/objects/test_projects.py | 51 ++++++++++++++------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/gitlab/tests/objects/test_projects.py b/gitlab/tests/objects/test_projects.py index 93dadd0e2..1d72a7235 100644 --- a/gitlab/tests/objects/test_projects.py +++ b/gitlab/tests/objects/test_projects.py @@ -252,6 +252,24 @@ def resp_import_status(url, request): return response(200, content, headers, None, 25, request) +@urlmatch( + scheme="http", + netloc="localhost", + path="/api/v4/import/github", + method="post", +) +def resp_import_github(url, request): + headers = {"content-type": "application/json"} + content = """{ + "id": 27, + "name": "my-repo", + "full_path": "/root/my-repo", + "full_name": "Administrator / my-repo" + }""" + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + class TestProjectImport(TestProject): @with_httmock(resp_import_project) def test_import_project(self): @@ -264,29 +282,12 @@ def test_refresh_project_import_status(self): project_import.refresh() self.assertEqual(project_import.import_status, "finished") + @with_httmock(resp_import_github) def test_import_github(self): - @urlmatch( - scheme="http", - netloc="localhost", - path="/api/v4/import/github", - method="post", - ) - def resp_import_github(url, request): - headers = {"content-type": "application/json"} - content = """{ - "id": 27, - "name": "my-repo", - "full_path": "/root/my-repo", - "full_name": "Administrator / my-repo" - }""" - content = content.encode("utf-8") - return response(200, content, headers, None, 25, request) - - with HTTMock(resp_import_github): - base_path = "/root" - name = "my-repo" - ret = self.gl.projects.import_github("githubkey", 1234, base_path, name) - self.assertIsInstance(ret, dict) - self.assertEqual(ret["name"], name) - self.assertEqual(ret["full_path"], "/".join((base_path, name))) - self.assertTrue(ret["full_name"].endswith(name)) + base_path = "/root" + name = "my-repo" + ret = self.gl.projects.import_github("githubkey", 1234, base_path, name) + self.assertIsInstance(ret, dict) + self.assertEqual(ret["name"], name) + self.assertEqual(ret["full_path"], "/".join((base_path, name))) + self.assertTrue(ret["full_name"].endswith(name)) From 4fede5d692fdd4477a37670b7b35268f5d1c4bf0 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sun, 8 Mar 2020 18:45:33 +0100 Subject: [PATCH 6/8] chore: clean up for black and flake8 --- gitlab/tests/objects/test_projects.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gitlab/tests/objects/test_projects.py b/gitlab/tests/objects/test_projects.py index 1d72a7235..772d937c9 100644 --- a/gitlab/tests/objects/test_projects.py +++ b/gitlab/tests/objects/test_projects.py @@ -16,7 +16,7 @@ class TestProject(unittest.TestCase): - """Base class for GitLab Project tests""" + """Base class for GitLab Project tests.""" def setUp(self): self.gl = Gitlab( @@ -150,7 +150,7 @@ def resp_create_snippet(url, request): scheme="http", netloc="localhost", path="/api/v4/projects/1/export", method="post", ) def resp_create_export(url, request): - """Common mock for Project Export tests""" + """Common mock for Project Export tests.""" content = """{ "message": "202 Accepted" }""" @@ -162,7 +162,7 @@ def resp_create_export(url, request): scheme="http", netloc="localhost", path="/api/v4/projects/1/export", method="get", ) def resp_export_status(url, request): - """mock for Project Export GET response""" + """Mock for Project Export GET response.""" content = """{ "id": 1, "description": "Itaque perspiciatis minima aspernatur", @@ -218,7 +218,7 @@ def test_download_project_export(self): scheme="http", netloc="localhost", path="/api/v4/projects/import", method="post", ) def resp_import_project(url, request): - """Mock for Project Import POST response""" + """Mock for Project Import POST response.""" content = """{ "id": 1, "description": null, @@ -237,7 +237,7 @@ def resp_import_project(url, request): scheme="http", netloc="localhost", path="/api/v4/projects/1/import", method="get", ) def resp_import_status(url, request): - """Mock for Project Import GET response""" + """Mock for Project Import GET response.""" content = """{ "id": 1, "description": "Itaque perspiciatis minima aspernatur corporis consequatur.", @@ -253,13 +253,9 @@ def resp_import_status(url, request): @urlmatch( - scheme="http", - netloc="localhost", - path="/api/v4/import/github", - method="post", + scheme="http", netloc="localhost", path="/api/v4/import/github", method="post", ) def resp_import_github(url, request): - headers = {"content-type": "application/json"} content = """{ "id": 27, "name": "my-repo", @@ -276,7 +272,7 @@ def test_import_project(self): project_import = self.gl.projects.import_project("file", "api-project") self.assertEqual(project_import["import_status"], "scheduled") - @with_httmock(resp_import_project, resp_import_status) + @with_httmock(resp_import_status) def test_refresh_project_import_status(self): project_import = self.project.imports.get() project_import.refresh() From 0bff71353937a451b1092469330034062d24ff71 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Wed, 18 Mar 2020 18:14:40 -0400 Subject: [PATCH 7/8] test: move mocks to top of module --- gitlab/tests/objects/test_projects.py | 202 +++++++++++++------------- 1 file changed, 102 insertions(+), 100 deletions(-) diff --git a/gitlab/tests/objects/test_projects.py b/gitlab/tests/objects/test_projects.py index 772d937c9..d87f75930 100644 --- a/gitlab/tests/objects/test_projects.py +++ b/gitlab/tests/objects/test_projects.py @@ -15,6 +15,108 @@ binary_content = b"binary content" +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/projects/1/export", method="post", +) +def resp_create_export(url, request): + """Common mock for Project Export tests.""" + content = """{ + "message": "202 Accepted" + }""" + content = content.encode("utf-8") + return response(202, content, headers, None, 25, request) + + +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/projects/1/export", method="get", +) +def resp_export_status(url, request): + """Mock for Project Export GET response.""" + content = """{ + "id": 1, + "description": "Itaque perspiciatis minima aspernatur", + "name": "Gitlab Test", + "name_with_namespace": "Gitlab Org / Gitlab Test", + "path": "gitlab-test", + "path_with_namespace": "gitlab-org/gitlab-test", + "created_at": "2017-08-29T04:36:44.383Z", + "export_status": "finished", + "_links": { + "api_url": "https://gitlab.test/api/v4/projects/1/export/download", + "web_url": "https://gitlab.test/gitlab-test/download_export" + } + } + """ + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + +@urlmatch( + scheme="http", + netloc="localhost", + path="/api/v4/projects/1/export/download", + method="get", +) +def resp_download_export(url, request): + """Mock for Project Export Download GET response.""" + headers = {"content-type": "application/octet-stream"} + content = binary_content + return response(200, content, headers, None, 25, request) + + +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/projects/import", method="post", +) +def resp_import_project(url, request): + """Mock for Project Import POST response.""" + content = """{ + "id": 1, + "description": null, + "name": "api-project", + "name_with_namespace": "Administrator / api-project", + "path": "api-project", + "path_with_namespace": "root/api-project", + "created_at": "2018-02-13T09:05:58.023Z", + "import_status": "scheduled" + }""" + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/projects/1/import", method="get", +) +def resp_import_status(url, request): + """Mock for Project Import GET response.""" + content = """{ + "id": 1, + "description": "Itaque perspiciatis minima aspernatur corporis consequatur.", + "name": "Gitlab Test", + "name_with_namespace": "Gitlab Org / Gitlab Test", + "path": "gitlab-test", + "path_with_namespace": "gitlab-org/gitlab-test", + "created_at": "2017-08-29T04:36:44.383Z", + "import_status": "finished" + }""" + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + +@urlmatch( + scheme="http", netloc="localhost", path="/api/v4/import/github", method="post", +) +def resp_import_github(url, request): + """Mock for GitHub Project Import POST response.""" + content = """{ + "id": 27, + "name": "my-repo", + "full_path": "/root/my-repo", + "full_name": "Administrator / my-repo" + }""" + content = content.encode("utf-8") + return response(200, content, headers, None, 25, request) + + class TestProject(unittest.TestCase): """Base class for GitLab Project tests.""" @@ -146,54 +248,6 @@ def resp_create_snippet(url, request): self.assertEqual(snippet.visibility, visibility) -@urlmatch( - scheme="http", netloc="localhost", path="/api/v4/projects/1/export", method="post", -) -def resp_create_export(url, request): - """Common mock for Project Export tests.""" - content = """{ - "message": "202 Accepted" - }""" - content = content.encode("utf-8") - return response(202, content, headers, None, 25, request) - - -@urlmatch( - scheme="http", netloc="localhost", path="/api/v4/projects/1/export", method="get", -) -def resp_export_status(url, request): - """Mock for Project Export GET response.""" - content = """{ - "id": 1, - "description": "Itaque perspiciatis minima aspernatur", - "name": "Gitlab Test", - "name_with_namespace": "Gitlab Org / Gitlab Test", - "path": "gitlab-test", - "path_with_namespace": "gitlab-org/gitlab-test", - "created_at": "2017-08-29T04:36:44.383Z", - "export_status": "finished", - "_links": { - "api_url": "https://gitlab.test/api/v4/projects/1/export/download", - "web_url": "https://gitlab.test/gitlab-test/download_export" - } - } - """ - content = content.encode("utf-8") - return response(200, content, headers, None, 25, request) - - -@urlmatch( - scheme="http", - netloc="localhost", - path="/api/v4/projects/1/export/download", - method="get", -) -def resp_download_export(url, request): - headers = {"content-type": "application/octet-stream"} - content = binary_content - return response(200, content, headers, None, 25, request) - - class TestProjectExport(TestProject): @with_httmock(resp_create_export) def test_create_project_export(self): @@ -214,58 +268,6 @@ def test_download_project_export(self): self.assertEqual(download, binary_content) -@urlmatch( - scheme="http", netloc="localhost", path="/api/v4/projects/import", method="post", -) -def resp_import_project(url, request): - """Mock for Project Import POST response.""" - content = """{ - "id": 1, - "description": null, - "name": "api-project", - "name_with_namespace": "Administrator / api-project", - "path": "api-project", - "path_with_namespace": "root/api-project", - "created_at": "2018-02-13T09:05:58.023Z", - "import_status": "scheduled" - }""" - content = content.encode("utf-8") - return response(200, content, headers, None, 25, request) - - -@urlmatch( - scheme="http", netloc="localhost", path="/api/v4/projects/1/import", method="get", -) -def resp_import_status(url, request): - """Mock for Project Import GET response.""" - content = """{ - "id": 1, - "description": "Itaque perspiciatis minima aspernatur corporis consequatur.", - "name": "Gitlab Test", - "name_with_namespace": "Gitlab Org / Gitlab Test", - "path": "gitlab-test", - "path_with_namespace": "gitlab-org/gitlab-test", - "created_at": "2017-08-29T04:36:44.383Z", - "import_status": "finished" - }""" - content = content.encode("utf-8") - return response(200, content, headers, None, 25, request) - - -@urlmatch( - scheme="http", netloc="localhost", path="/api/v4/import/github", method="post", -) -def resp_import_github(url, request): - content = """{ - "id": 27, - "name": "my-repo", - "full_path": "/root/my-repo", - "full_name": "Administrator / my-repo" - }""" - content = content.encode("utf-8") - return response(200, content, headers, None, 25, request) - - class TestProjectImport(TestProject): @with_httmock(resp_import_project) def test_import_project(self): From 9b16614ba6444b212b3021a741b9c184ac206af1 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Wed, 18 Mar 2020 19:25:34 -0400 Subject: [PATCH 8/8] fix: add missing import_project param --- gitlab/v4/objects.py | 3 +++ tools/python_test_v4.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index f832b7112..9da9adf2c 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -4839,6 +4839,7 @@ def import_project( self, file, path, + name=None, namespace=None, overwrite=False, override_params=None, @@ -4868,6 +4869,8 @@ def import_project( if override_params: for k, v in override_params.items(): data["override_params[%s]" % k] = v + if name is not None: + data["name"] = name if namespace: data["namespace"] = namespace return self.gitlab.http_post( diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 90aa7f162..fad8c69eb 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -962,9 +962,13 @@ ex.download(streamed=True, action=f.write) output = gl.projects.import_project( - open("/tmp/gitlab-export.tgz", "rb"), "imported_project" + open("/tmp/gitlab-export.tgz", "rb"), "imported_project", name="Imported Project" ) project_import = gl.projects.get(output["id"], lazy=True).imports.get() + +assert project_import.path == "imported_project" +assert project_import.name == "Imported Project" + count = 0 while project_import.import_status != "finished": time.sleep(1)