forked from pyapi-gitlab/pyapi-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_tags.py
More file actions
31 lines (25 loc) · 1.04 KB
/
test_tags.py
File metadata and controls
31 lines (25 loc) · 1.04 KB
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
import responses
from requests.exceptions import HTTPError
from gitlab_tests.base_test import BaseTest
from response_data.tags import *
class TestDeleteRepositoryTag(BaseTest):
@responses.activate
def test_delete_repository_tag(self):
responses.add(
responses.DELETE,
self.gitlab.api_url + '/projects/5/repository/tags/test',
json=delete_repository_tag,
status=200,
content_type='application/json')
self.assertEqual(delete_repository_tag, self.gitlab.delete_repository_tag(5, 'test'))
@responses.activate
def test_delete_repository_tag_exception(self):
responses.add(
responses.DELETE,
self.gitlab.api_url + '/projects/5/repository/tags/test',
json='{"message":"No such tag"}',
status=404,
content_type='application/json')
self.gitlab.suppress_http_error = False
self.assertRaises(HTTPError, self.gitlab.delete_repository_tag, 5, 'test')
self.gitlab.suppress_http_error = True