summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2020-02-23 17:15:00 +0100
committerNejc Habjan <hab.nejc@gmail.com>2020-02-23 17:15:49 +0100
commit32844c7b27351b08bb86d8f9bd8fe9cf83917a5a (patch)
tree6b4f3f3bf38737c2e519030dacdede2a69b6828d /gitlab
parente8f0921d164c4b7db78e2f62e75eb32094b4456e (diff)
downloadgitlab-32844c7b27351b08bb86d8f9bd8fe9cf83917a5a.tar.gz
test: add unit tests for base URLs with trailing slashes
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/tests/test_gitlab.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py
index b56889a..b5c0ed5 100644
--- a/gitlab/tests/test_gitlab.py
+++ b/gitlab/tests/test_gitlab.py
@@ -376,6 +376,23 @@ class TestGitlabHttpMethods(unittest.TestCase):
self.assertRaises(GitlabHttpError, self.gl.http_delete, "/not_there")
+class TestGitlabStripBaseUrl(unittest.TestCase):
+ def setUp(self):
+ self.gl = Gitlab(
+ "http://localhost/", private_token="private_token", api_version=4
+ )
+
+ def test_strip_base_url(self):
+ self.assertEqual(self.gl.url, "http://localhost")
+
+ def test_strip_api_url(self):
+ self.assertEqual(self.gl.api_url, "http://localhost/api/v4")
+
+ def test_build_url(self):
+ r = self.gl._build_url("/projects")
+ self.assertEqual(r, "http://localhost/api/v4/projects")
+
+
class TestGitlabAuth(unittest.TestCase):
def test_invalid_auth_args(self):
self.assertRaises(