Skip to content

Commit 32844c7

Browse files
committed
test: add unit tests for base URLs with trailing slashes
1 parent e8f0921 commit 32844c7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

gitlab/tests/test_gitlab.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,23 @@ def resp_cont(url, request):
376376
self.assertRaises(GitlabHttpError, self.gl.http_delete, "/not_there")
377377

378378

379+
class TestGitlabStripBaseUrl(unittest.TestCase):
380+
def setUp(self):
381+
self.gl = Gitlab(
382+
"http://localhost/", private_token="private_token", api_version=4
383+
)
384+
385+
def test_strip_base_url(self):
386+
self.assertEqual(self.gl.url, "http://localhost")
387+
388+
def test_strip_api_url(self):
389+
self.assertEqual(self.gl.api_url, "http://localhost/api/v4")
390+
391+
def test_build_url(self):
392+
r = self.gl._build_url("/projects")
393+
self.assertEqual(r, "http://localhost/api/v4/projects")
394+
395+
379396
class TestGitlabAuth(unittest.TestCase):
380397
def test_invalid_auth_args(self):
381398
self.assertRaises(

0 commit comments

Comments
 (0)