Skip to content

Commit c676b43

Browse files
authored
Merge pull request #2332 from python-gitlab/jlvillal/fix_test
test: fix `test_project_push_rules` test
2 parents dd04e8e + 8779cf6 commit c676b43

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/functional/api/test_push_rules.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import pytest
22

3+
import gitlab
4+
35

46
@pytest.mark.gitlab_premium
5-
@pytest.mark.xfail(reason="need to relax RESTObject init for non-dict responses")
67
def test_project_push_rules(project):
7-
push_rules = project.pushrules.get()
8-
assert not push_rules
8+
with pytest.raises(gitlab.GitlabParsingError):
9+
# when no rules are defined the API call returns back `None` which
10+
# causes a gitlab.GitlabParsingError in RESTObject.__init__()
11+
project.pushrules.get()
912

1013
push_rules = project.pushrules.create({"deny_delete_tag": True})
1114
assert push_rules.deny_delete_tag
@@ -18,4 +21,6 @@ def test_project_push_rules(project):
1821
assert not push_rules.deny_delete_tag
1922

2023
push_rules.delete()
21-
assert not push_rules
24+
25+
with pytest.raises(gitlab.GitlabParsingError):
26+
project.pushrules.get()

0 commit comments

Comments
 (0)