summaryrefslogtreecommitdiff
path: root/gitlab/tests
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/tests')
-rw-r--r--gitlab/tests/test_gitlab.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py
index 337320f..7872083 100644
--- a/gitlab/tests/test_gitlab.py
+++ b/gitlab/tests/test_gitlab.py
@@ -338,7 +338,7 @@ class TestGitlabMethods(unittest.TestCase):
self.assertRaises(GitlabGetError, self.gl.get,
Project, 1)
- def test_delete(self):
+ def test_delete_from_object(self):
@urlmatch(scheme="http", netloc="localhost", path="/api/v3/groups/1",
method="delete")
def resp_delete_group(url, request):
@@ -351,6 +351,24 @@ class TestGitlabMethods(unittest.TestCase):
data = self.gl.delete(obj)
self.assertIs(data, True)
+ def test_delete_from_invalid_class(self):
+ class InvalidClass(object):
+ pass
+
+ self.assertRaises(GitlabError, self.gl.delete, InvalidClass, 1)
+
+ def test_delete_from_class(self):
+ @urlmatch(scheme="http", netloc="localhost", path="/api/v3/groups/1",
+ method="delete")
+ def resp_delete_group(url, request):
+ headers = {'content-type': 'application/json'}
+ content = ''.encode("utf-8")
+ return response(200, content, headers, None, 5, request)
+
+ with HTTMock(resp_delete_group):
+ data = self.gl.delete(Group, 1)
+ self.assertIs(data, True)
+
def test_delete_unknown_path(self):
obj = Project(self.gl, data={"name": "testname", "id": 1})
obj._from_api = True