diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2017-11-10 10:22:52 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2017-11-10 10:22:52 +0100 |
commit | 700e84f3ea1a8e0f99775d02cd1a832d05d3ec8d (patch) | |
tree | e5c6483e1da1451aa45a3bb078281aaa1b673058 /gitlab/tests | |
parent | 07328263c317d7ee78723fee8b66f48abffcfb36 (diff) | |
download | gitlab-700e84f3ea1a8e0f99775d02cd1a832d05d3ec8d.tar.gz |
Add missing mocking on unit test
Diffstat (limited to 'gitlab/tests')
-rw-r--r-- | gitlab/tests/test_gitlab.py | 12 |
1 files changed, 11 insertions, 1 deletions
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", |