summaryrefslogtreecommitdiff
path: root/gitlab/tests/test_gitlab.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2015-05-13 18:23:55 +0200
committerGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2015-05-13 18:23:55 +0200
commit4c6c7785ba17d053548181fc2eafbe3356ea33f5 (patch)
tree6499d02943f033a0e4eca0d909fe3ed6141e4b9e /gitlab/tests/test_gitlab.py
parent7bdb1be12e5038085c2cfb416a50d8015bf3db58 (diff)
downloadgitlab-4c6c7785ba17d053548181fc2eafbe3356ea33f5.tar.gz
Fix the tests when the host runs a web server
Diffstat (limited to 'gitlab/tests/test_gitlab.py')
-rw-r--r--gitlab/tests/test_gitlab.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py
index dc23408..f84bf86 100644
--- a/gitlab/tests/test_gitlab.py
+++ b/gitlab/tests/test_gitlab.py
@@ -206,6 +206,7 @@ class TestGitLabMethods(unittest.TestCase):
self.assertRaises(GitlabListError, self.gl.list, ProjectBranch)
def test_list_no_connection(self):
+ self.gl.set_url('http://localhost:66000')
self.assertRaises(GitlabConnectionError, self.gl.list, ProjectBranch,
project_id=1)
@@ -348,7 +349,17 @@ class TestGitLabMethods(unittest.TestCase):
obj = User(self.gl, data={"email": "email", "password": "password",
"username": "username", "name": "name",
"can_create_group": True})
- self.assertRaises(GitlabConnectionError, self.gl.create, obj)
+ obj._created = True
+
+ @urlmatch(scheme="http", netloc="localhost", path="/api/v3/projects/1",
+ method="delete")
+ 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(GitlabCreateError, self.gl.create, obj)
def test_create_401(self):
obj = Group(self.gl, data={"name": "testgroup", "path": "testpath"})