summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-10-19 18:25:35 +0200
committerGitHub <noreply@github.com>2022-10-19 18:25:35 +0200
commitc676b43dc4a5dd7dc0797f5bcf7db830db7645e7 (patch)
tree1e7da07c2300608d1551d2772177ccf3a04fdaa7
parentdd04e8ef7eee2793fba38a1eec019b00b3bb616e (diff)
parent8779cf672af1abd1a1f67afef20a61ae5876a724 (diff)
downloadgitlab-c676b43dc4a5dd7dc0797f5bcf7db830db7645e7.tar.gz
Merge pull request #2332 from python-gitlab/jlvillal/fix_test
test: fix `test_project_push_rules` test
-rw-r--r--tests/functional/api/test_push_rules.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/functional/api/test_push_rules.py b/tests/functional/api/test_push_rules.py
index f82a873..15a3140 100644
--- a/tests/functional/api/test_push_rules.py
+++ b/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
@@ -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()