From e1e643b2ae3f429ac74a92954699e955814ebdac Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 07 2019 13:37:47 +0000 Subject: [PATCH 1/2] Make pagure-dist-git's tests work with the newer pagure Signed-off-by: Pierre-Yves Chibon --- diff --git a/dist_git_auth.py b/dist_git_auth.py index d592801..a1c2362 100644 --- a/dist_git_auth.py +++ b/dist_git_auth.py @@ -29,7 +29,12 @@ if "PAGURE_CONFIG" not in os.environ and os.path.exists( os.environ["PAGURE_CONFIG"] = "/etc/pagure/pagure.cfg" from pagure.config import config as pagure_config -from pagure.lib import model, get_user +from pagure.lib import model +try: + from pagure.lib import get_user +except ImportError: + # From pagure 5.2, code has been moved to pagure.lib.query + from pagure.lib.query import get_user from pagure.lib.git import is_forced_push from pagure.lib.git_auth import GitAuthHelper, _read_file from pagure.utils import is_repo_committer diff --git a/dist_git_auth_tests.py b/dist_git_auth_tests.py index a0fb33e..f792c34 100644 --- a/dist_git_auth_tests.py +++ b/dist_git_auth_tests.py @@ -8,8 +8,15 @@ from mock import Mock, patch # These are the tests from the pagure/ git repo. # Run with: # PYTHONPATH=.:/path/to/pagure/checkout nosetests dist_git_auth_tests.py -import pagure -import pagure.lib +import pagure.config +import pagure.exceptions +import pagure.lib.model +try: + from pagure.lib import _get_project as get_project +except ImportError: + # From pagure 5.2, code has been moved to pagure.lib.query + from pagure.lib.query import _get_project as get_project + import tests import dist_git_auth @@ -124,7 +131,7 @@ class DistGitAuthTests(tests.Modeltests): 'Invalid', 'Insufficient data', 'Fixed', 'Duplicate'] self.session.add(item) self.session.commit() - return pagure.lib._get_project( + return get_project( self.session, name=name, namespace=namespace) def expect_info_msg(self, expect_msg): From c528dfee31690dea75ac57053c1f1cf757689488 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 07 2019 13:37:47 +0000 Subject: [PATCH 2/2] Add a test ensuring SIG can push to their exact sub-branch This basically adds a test for cc2e22ecc6af36b3b590a7f63e35e24b345a878e (Cf PR: https://pagure.io/pagure-dist-git/pull-request/62 ) Signed-off-by: Pierre-Yves Chibon --- diff --git a/dist_git_auth_tests.py b/dist_git_auth_tests.py index f792c34..355f381 100644 --- a/dist_git_auth_tests.py +++ b/dist_git_auth_tests.py @@ -649,6 +649,26 @@ class DistGitAuthTestsCentOS(DistGitAuthTests): self.expect_info_msg("SIG push") + def test_protected_sig_sig_member_precise(self): + project = self.create_namespaced_project('rpms', 'test') + + self.assertTrue( + self.dga.check_acl( + self.session, + project=project, + username="arrfab", + refname="refs/heads/c7-sig-core", + pull_request=None, + repodir=None, + repotype='main', + revfrom=None, + revto=None, + is_internal=False, + ) + ) + + self.expect_info_msg("SIG push") + def test_protected_sig_no_sig_member(self): project = self.create_namespaced_project('rpms', 'test')