8000 Fix the tests when the host runs a web server · python-gitlab/python-gitlab@4c6c778 · GitHub
[go: up one dir, main page]

Skip to content < 8000 div data-target="react-partial.reactRoot">

Commit 4c6c778

Browse files
author
Gauvain Pocentek
committed
Fix the tests when the host runs a web server
1 parent 7bdb1be commit 4c6c778

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

gitlab/tests/test_gitlab.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def test_list_kw_missing(self):
206206
self.assertRaises(GitlabListError, self.gl.list, ProjectBranch)
207207

208208
def test_list_no_connection(self):
209+
self.gl.set_url('http://localhost:66000')
209210
self.assertRaises(GitlabConnectionError, self.gl.list, ProjectBranch,
210211
project_id=1)
211212

@@ -348,7 +349,17 @@ def test_create_unknown_path(self):
348349
obj = User(self.gl, data={"email": "email", "password": "password",
349350
"username": "username", "name": "name",
350351
"can_create_group": True})
351-
self.assertRaises(GitlabConnectionError, self.gl.create, obj)
352+
obj._created = True
353+
354+
@urlmatch(scheme="http", netloc="localhost", path="/api/v3/projects/1",
355+
method="delete")
356+
def resp_cont(url, request):
357+
headers = {'content-type': 'application/json'}
358+
content = '{"message": "message"}'.encode("utf-8")
359+
return response(404, content, headers, None, 5, request)
360+
361+
with HTTMock(resp_cont):
362+
self.assertRaises(GitlabCreateError, self.gl.create, obj)
352363

353364
def test_create_401(self):
354365
obj = Group(self.gl, data={"name": "testgroup", "path": "testpath"})

0 commit comments

Comments
 (0)
0