Skip to content

Commit 700e84f

Browse files
author
Gauvain Pocentek
committed
Add missing mocking on unit test
1 parent 0732826 commit 700e84f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

gitlab/tests/test_gitlab.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,17 @@ def test_pickability(self):
951951
def test_credentials_auth_nopassword(self):
952952
self.gl.email = None
953953
self.gl.password = None
954-
self.assertRaises(GitlabAuthenticationError, self.gl._credentials_auth)
954+
955+
@urlmatch(scheme="http", netloc="localhost", path="/api/v3/session",
956+
method="post")
957+
def resp_cont(url, request):
958+
headers = {'content-type': 'application/json'}
959+
content = '{"message": "message"}'.encode("utf-8")
960+
return response(404, content, headers, None, 5, request)
961+
962+
with HTTMock(resp_cont):
963+
self.assertRaises(GitlabAuthenticationError,
964+
self.gl._credentials_auth)
955965

956966
def test_credentials_auth_notok(self):
957967
@urlmatch(scheme="http", netloc="localhost", path="/api/v3/session",

0 commit comments

Comments
 (0)