From 700e84f3ea1a8e0f99775d02cd1a832d05d3ec8d Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Fri, 10 Nov 2017 10:22:52 +0100 Subject: Add missing mocking on unit test --- gitlab/tests/test_gitlab.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'gitlab') diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py index d9853d0..d33df99 100644 --- a/gitlab/tests/test_gitlab.py +++ b/gitlab/tests/test_gitlab.py @@ -951,7 +951,17 @@ class TestGitlab(unittest.TestCase): 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", -- cgit v1.2.1