summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2015-12-31 07:07:45 +0100
committerGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2015-12-31 07:07:45 +0100
commit1db3cc1e4f7e8f3bfae1f2e8cdbd377701789eb4 (patch)
tree70f2bd456f277c25cda2d4dddb43f70baf57b1fc
parent2a76b7490ba3dc6de6080d2dab55be017c09db59 (diff)
downloadgitlab-1db3cc1e4f7e8f3bfae1f2e8cdbd377701789eb4.tar.gz
fix the tests
-rw-r--r--gitlab/__init__.py4
-rw-r--r--gitlab/tests/test_gitlab.py10
2 files changed, 10 insertions, 4 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index 7b23903..ebd7648 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -697,7 +697,9 @@ class GitlabObject(object):
@classmethod
def get(cls, gl, id, **kwargs):
- if cls.canGet is True:
+ if cls.canGet is False:
+ raise NotImplementedError
+ elif cls.canGet is True:
return cls(gl, id, **kwargs)
elif cls.canGet == 'from_list':
for obj in cls.list(gl, **kwargs):
diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py
index a0f35bb..8331964 100644
--- a/gitlab/tests/test_gitlab.py
+++ b/gitlab/tests/test_gitlab.py
@@ -677,15 +677,19 @@ class TestGitLab(unittest.TestCase):
self.assertEqual(data.id, 1)
def test_Issue(self):
- @urlmatch(scheme="http", netloc="localhost", path="/api/v3/issues/1",
+ @urlmatch(scheme="http", netloc="localhost", path="/api/v3/issues",
method="get")
def resp_get_issue(url, request):
headers = {'content-type': 'application/json'}
- content = '{"name": "name", "id": 1}'.encode("utf-8")
+ content = ('[{"name": "name", "id": 1}, '
+ '{"name": "other_name", "id": 2}]')
+ content = content.encode("utf-8")
return response(200, content, headers, None, 5, request)
with HTTMock(resp_get_issue):
- self.assertRaises(NotImplementedError, self.gl.Issue, id=1)
+ data = self.gl.Issue(id=2)
+ self.assertEqual(data.id, 2)
+ self.assertEqual(data.name, 'other_name')
def test_User(self):
@urlmatch(scheme="http", netloc="localhost", path="/api/v3/users/1",