forked from pyapi-gitlab/pyapi-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_delete.py
More file actions
32 lines (26 loc) · 969 Bytes
/
test_delete.py
File metadata and controls
32 lines (26 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import responses
from requests.exceptions import HTTPError
from gitlab_tests.base_test import BaseTest
from response_data.users import *
class TestDelete(BaseTest):
@responses.activate
def test_delete(self):
responses.add(
responses.DELETE,
self.gitlab.api_url + '/users/5',
json=None,
status=204,
content_type='application/json')
self.assertEqual({}, self.gitlab.delete('/users/5'))
self.assertEqual({}, self.gitlab.delete('/users/5', default_response={}))
@responses.activate
def test_delete_404(self):
responses.add(
responses.POST,
self.gitlab.api_url + '/users',
body=post_users_error,
status=409,
content_type='application/json')
self.gitlab.suppress_http_error = False
self.assertRaises(HTTPError, self.gitlab.post, '/users')
self.gitlab.suppress_http_error = True