From be6a9134764e94c21fe1e116b0f82f30e86ef906 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 30 2017 10:05:22 +0000 Subject: Add unit-tests for pagure.lib.git.generate_gitolite_acls() --- diff --git a/tests/test_pagure_lib_git.py b/tests/test_pagure_lib_git.py index 29c8ea2..f7f59b4 100644 --- a/tests/test_pagure_lib_git.py +++ b/tests/test_pagure_lib_git.py @@ -2515,7 +2515,20 @@ index 0000000..60f7480 domerge=False ) + @patch('subprocess.Popen') + def test_generate_gitolite_acls(self, popen): + """ Test calling generate_gitolite_acls. """ + pagure.SESSION = self.session + pagure.lib.git.SESSION = self.session + pagure.APP.config['GITOLITE_HOME'] = '/tmp' + + pagure.lib.git.generate_gitolite_acls() + popen.assert_called_with( + 'HOME=/tmp gitolite compile && ' + 'HOME=/tmp gitolite trigger POST_COMPILE', + cwd='/tmp', shell=True, stderr=-1, stdout=-1 + ) + if __name__ == '__main__': - SUITE = unittest.TestLoader().loadTestsFromTestCase(PagureLibGittests) - unittest.TextTestRunner(verbosity=2).run(SUITE) + unittest.main(verbosity=2)