diff options
| author | Max Wittig <max.wittig95@gmail.com> | 2019-12-16 20:47:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-16 20:47:22 +0100 |
| commit | 97e1fcab30a274cecf4332233cbf420d752143e0 (patch) | |
| tree | 2b8832fe06dfa0fb7e9fe700449644a8d8beaf16 /gitlab/tests | |
| parent | 61eaad2ff32776c121eeb67202b0063a7b1cc2e1 (diff) | |
| parent | e9a8289a381ebde7c57aa2364258d84b4771d276 (diff) | |
| download | gitlab-97e1fcab30a274cecf4332233cbf420d752143e0.tar.gz | |
Merge pull request #959 from andrew-littlebits/feat/import-github
feat: add support for /import/github
Diffstat (limited to 'gitlab/tests')
| -rw-r--r-- | gitlab/tests/test_gitlab.py | 27 |
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) |
