8000 Update tests for list() changes · python-gitlab/python-gitlab@7592ec5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7592ec5

Browse files
author
Gauvain Pocentek
committed
Update tests for list() changes
1 parent 217dc3e commit 7592ec5

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

gitlab/tests/test_gitlab.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def resp_2(url, request):
205205
return response(200, content, headers, None, 5, request)
206206

207207
with HTTMock(resp_1):
208-
obj = self.gl.http_list('/tests')
208+
obj = self.gl.http_list('/tests', as_list=False)
209209
self.assertEqual(len(obj), 2)
210210
self.assertEqual(obj._next_url,
211211
'http://localhost/api/v4/tests?per_page=1&page=2')
@@ -311,7 +311,12 @@ def resp_cont(url, request):
311311
return response(200, content, headers, None, 5, request)
312312

313313
with HTTMock(resp_cont):
314-
result = self.gl.http_list('/projects')
314+
result = self.gl.http_list('/projects', as_list=True)
315+
self.assertIsInstance(result, list)
316+
self.assertEqual(len(result), 1)
317+
318+
with HTTMock(resp_cont):
319+
result = self.gl.http_list('/projects', as_list=False)
315320
self.assertIsInstance(result, GitlabList)
316321
self.assertEqual(len(result), 1)
317322

@@ -324,7 +329,7 @@ def test_list_request_404(self):
324329
@urlmatch(scheme="http", netloc="localhost",
325330
path="/api/v4/not_there", method="get")
326331
def resp_cont(url, request):
327-
content = {'Here is wh it failed'}
332+
content = {'Here is why it failed'}
328333
return response(404, content, {}, None, 5, request)
329334

330335
with HTTMock(resp_cont):

gitlab/tests/test_mixins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def resp_cont(url, request):
178178
with HTTMock(resp_cont):
179179
# test RESTObjectList
180180
mgr = M(self.gl)
181-
obj_list = mgr.list()
181+
obj_list = mgr.list(as_list=False)
182182
self.assertIsInstance(obj_list, base.RESTObjectList)
183183
for obj in obj_list:
184184
self.assertIsInstance(obj, FakeObject)
@@ -205,7 +205,7 @@ def resp_cont(url, request):
205205

206206
with HTTMock(resp_cont):
207207
mgr = M(self.gl)
208-
obj_list = mgr.list(path='/others')
208+
obj_list = mgr.list(path='/others', as_list=False)
209209
self.assertIsInstance(obj_list, base.RESTObjectList)
210210
obj = obj_list.next()
211211
self.assertEqual(obj.id, 42)

0 commit comments

Comments
 (0)
0