Skip to content

Commit

Permalink
test: fix test_project_push_rules test
Browse files Browse the repository at this point in the history
Make the `test_project_push_rules` test work.
  • Loading branch information
JohnVillalovos committed Oct 19, 2022
1 parent dd04e8e commit 8779cf6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/functional/api/test_push_rules.py
@@ -1,11 +1,14 @@
import pytest

import gitlab


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

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

push_rules.delete()
assert not push_rules

with pytest.raises(gitlab.GitlabParsingError):
project.pushrules.get()

0 comments on commit 8779cf6

Please sign in to comment.