From fc8affd11c90d795a118f3def977a8dd37372ce0 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 30 Jan 2016 18:09:41 +0100 Subject: Fix Project.tree() Add API tests for tree(), blob() and archive(). --- gitlab/objects.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gitlab/objects.py') diff --git a/gitlab/objects.py b/gitlab/objects.py index ec66e17..d41b70e 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -1207,14 +1207,20 @@ class Project(GitlabObject): **kwargs) def tree(self, path='', ref_name='', **kwargs): - url = "%s/%s/repository/tree" % (self._url, self.id) - url += '?path=%s&ref_name=%s' % (path, ref_name) + url = "/projects/%s/repository/tree" % (self.id) + params = [] + if path: + params.append("path=%s" % path) + if ref_name: + params.append("ref_name=%s" % ref_name) + if params: + url += '?' + "&".join(params) r = self.gitlab._raw_get(url, **kwargs) raise_error_from_response(r, GitlabGetError) return r.json() def blob(self, sha, filepath, **kwargs): - url = "%s/%s/repository/blobs/%s" % (self._url, self.id, sha) + url = "/projects/%s/repository/blobs/%s" % (self.id, sha) url += '?filepath=%s' % (filepath) r = self.gitlab._raw_get(url, **kwargs) raise_error_from_response(r, GitlabGetError) -- cgit v1.2.1