Skip to content

test: fix test_project_push_rules test #2332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tests/functional/api/test_push_rules.py
Original file line number Diff line number Diff line change
@@ -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()