diff options
author | Mateusz Filipowicz <mateusz.filipowicz@roche.com> | 2020-03-01 14:24:42 +0100 |
---|---|---|
committer | Mateusz Filipowicz <mateusz.filipowicz@roche.com> | 2020-03-01 19:51:36 +0100 |
commit | 4e12356d6da58c9ef3d8bf9ae67e8aef8fafac0a (patch) | |
tree | dd6704e063182c7748ea493e1ff781f21b40a00c /gitlab/tests/test_gitlab.py | |
parent | f071390dadc4422c7d3cf77171334a617cfd9908 (diff) | |
download | gitlab-4e12356d6da58c9ef3d8bf9ae67e8aef8fafac0a.tar.gz |
feat(api): add support for GitLab OAuth Applications API
Diffstat (limited to 'gitlab/tests/test_gitlab.py')
-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 e7f1932..249d0c5 100644 --- a/gitlab/tests/test_gitlab.py +++ b/gitlab/tests/test_gitlab.py @@ -964,6 +964,33 @@ class TestGitlab(unittest.TestCase): 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) + + @urlmatch( + scheme="http", + netloc="localhost", + path="/api/v4/applications", + method="post", + ) + def resp_application_create(url, request): + headers = {"content-type": "application/json"} + return response(200, json_content, headers, None, 5, request) + + with HTTMock(resp_application_create): + application = self.gl.applications.create( + { + "name": "test_app", + "redirect_uri": "http://localhost:8080", + "scopes": ["api", "email"], + "confidential": False, + } + ) + self.assertEqual(application.name, "test_app") + self.assertEqual(application.redirect_uri, "http://localhost:8080") + self.assertEqual(application.scopes, ["api", "email"]) + def _default_config(self): fd, temp_path = tempfile.mkstemp() os.write(fd, valid_config) |