summaryrefslogtreecommitdiff
path: root/gitlab/tests
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/tests')
-rw-r--r--gitlab/tests/test_gitlab.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py
index 5bf373a..3eccf6e 100644
--- a/gitlab/tests/test_gitlab.py
+++ b/gitlab/tests/test_gitlab.py
@@ -844,6 +844,33 @@ class TestGitlab(unittest.TestCase):
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 _default_config(self):
fd, temp_path = tempfile.mkstemp()
os.write(fd, valid_config)