| |
@@ -6,7 +6,8 @@
|
| |
import mock
|
| |
|
| |
# These are the tests from the pagure/ git repo.
|
| |
- # Run with PYTHONPATH=.:/path/to/pagure/checkout nosetests dist_git_auth_tests.py
|
| |
+ # Run with:
|
| |
+ # PYTHONPATH=.:/path/to/pagure/checkout nosetests dist_git_auth_tests.py
|
| |
import pagure
|
| |
import tests
|
| |
|
| |
@@ -211,7 +212,7 @@
|
| |
|
| |
def test_get_supported_branches(self):
|
| |
""" Test for real what is returned by PDC. """
|
| |
- expected = ['master', 'f26', 'f25', 'f24', 'el6']
|
| |
+ expected = ['master', 'f26', 'f25', 'el6']
|
| |
actual = dist_git_auth.get_supported_branches('rpms', 'nethack')
|
| |
self.assertEquals(set(actual), set(expected))
|
| |
|
| |
@@ -313,3 +314,88 @@
|
| |
|
| |
# end of body'''
|
| |
self.assertMultiLineEqual(expected, contents.strip())
|
| |
+
|
| |
+ @mock.patch('dist_git_auth.get_supported_branches')
|
| |
+ def test_write_gitolite_acls_fork(
|
| |
+ self, get_supported_branches):
|
| |
+ """ Test updating the gitolite configuration file when forking a
|
| |
+ project.
|
| |
+
|
| |
+ """
|
| |
+
|
| |
+ get_supported_branches.return_value = ['master', 'f9000']
|
| |
+ self.test_write_gitolite_acls()
|
| |
+
|
| |
+ print("Forking the test project.")
|
| |
+ project = pagure.lib._get_project(self.session, 'test')
|
| |
+ pagure.lib.fork_project(
|
| |
+ session=self.session,
|
| |
+ user='pingou',
|
| |
+ repo=project,
|
| |
+ gitfolder=self.path,
|
| |
+ docfolder=None,
|
| |
+ ticketfolder=None,
|
| |
+ requestfolder=None)
|
| |
+
|
| |
+ print("Rewriting %r" % self.configfile)
|
| |
+ dist_git_auth.DistGitoliteAuth.write_gitolite_acls(
|
| |
+ self.session,
|
| |
+ configfile=self.configfile,
|
| |
+ project=-1
|
| |
+ )
|
| |
+
|
| |
+ print("Checking the contents of %r" % self.configfile)
|
| |
+ with open(self.configfile, 'r') as f:
|
| |
+ contents = f.read()
|
| |
+
|
| |
+ expected = '''repo test
|
| |
+ R = @all
|
| |
+ RWC master = pingou
|
| |
+ RWC f9000 = pingou
|
| |
+ - f[0-9][0-9] = @all
|
| |
+ - epel[0-9] = @all
|
| |
+ - epel[0-9][0-9] = @all
|
| |
+ - el[0-9] = @all
|
| |
+ - olpc[0-9] = @all
|
| |
+ RWC = pingou
|
| |
+
|
| |
+ repo requests/test
|
| |
+ RWC = pingou
|
| |
+
|
| |
+ repo test2
|
| |
+ R = @all
|
| |
+ RWC master = pingou
|
| |
+ RWC f9000 = pingou
|
| |
+ - f[0-9][0-9] = @all
|
| |
+ - epel[0-9] = @all
|
| |
+ - epel[0-9][0-9] = @all
|
| |
+ - el[0-9] = @all
|
| |
+ - olpc[0-9] = @all
|
| |
+ RWC = pingou
|
| |
+
|
| |
+ repo requests/test2
|
| |
+ RWC = pingou
|
| |
+
|
| |
+ repo somenamespace/test3
|
| |
+ R = @all
|
| |
+ RWC master = pingou
|
| |
+ RWC f9000 = pingou
|
| |
+ - f[0-9][0-9] = @all
|
| |
+ - epel[0-9] = @all
|
| |
+ - epel[0-9][0-9] = @all
|
| |
+ - el[0-9] = @all
|
| |
+ - olpc[0-9] = @all
|
| |
+ RWC = pingou
|
| |
+
|
| |
+ repo requests/somenamespace/test3
|
| |
+ RWC = pingou
|
| |
+
|
| |
+ repo forks/pingou/test
|
| |
+ R = @all
|
| |
+ RW+C = pingou
|
| |
+
|
| |
+ repo requests/forks/pingou/test
|
| |
+ RW+C = pingou
|
| |
+
|
| |
+ # end of body'''
|
| |
+ self.assertMultiLineEqual(expected, contents.strip())
|
| |
Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr