Skip to content

Commit

Permalink
Add missing mocking on unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed Nov 10, 2017
1 parent 0732826 commit 700e84f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gitlab/tests/test_gitlab.py
Expand Up @@ -951,7 +951,17 @@ def test_pickability(self):
def test_credentials_auth_nopassword(self):
self.gl.email = None
self.gl.password = None
self.assertRaises(GitlabAuthenticationError, self.gl._credentials_auth)

@urlmatch(scheme="http", netloc="localhost", path="/api/v3/session",
method="post")
def resp_cont(url, request):
headers = {'content-type': 'application/json'}
content = '{"message": "message"}'.encode("utf-8")
return response(404, content, headers, None, 5, request)

with HTTMock(resp_cont):
self.assertRaises(GitlabAuthenticationError,
self.gl._credentials_auth)

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

0 comments on commit 700e84f

Please sign in to comment.