diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index ac89707..2a5bfc1 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -3850,6 +3850,77 @@ index 0000000..fb7093d self.assertIn('', output.data) self.assertTrue(output.data.count('tagid'), 1) + def test_edit_file_no_signed_off(self): + """ Test the edit_file endpoint when signed-off isn't enforced. """ + tests.create_projects(self.session) + tests.create_projects_git( + os.path.join(self.path, 'repos'), bare=True) + + user = tests.FakeUser() + user.username = 'pingou' + with tests.user_set(self.app.application, user): + + # Add some content to the git repo + tests.add_content_git_repo( + os.path.join(self.path, 'repos', 'test.git')) + + output = self.app.get('/test/edit/master/f/sources') + self.assertEqual(output.status_code, 200) + self.assertIn( + '
  • ' + '  master' + '
  • ' + '  sources
  • ', + output.data) + self.assertIn( + '', + output.data) + self.assertIn( + '', output.data + ) + + def test_edit_file_signed_off(self): + """ Test the edit_file endpoint when signed-off is enforced. """ + tests.create_projects(self.session) + tests.create_projects_git( + os.path.join(self.path, 'repos'), bare=True) + + repo = pagure.lib.get_authorized_project(self.session, 'test') + settings = repo.settings + settings['Enforce_signed-off_commits_in_pull-request'] = True + repo.settings = settings + self.session.add(repo) + self.session.commit() + + user = tests.FakeUser() + user.username = 'pingou' + with tests.user_set(self.app.application, user): + + # Add some content to the git repo + tests.add_content_git_repo( + os.path.join(self.path, 'repos', 'test.git')) + + output = self.app.get('/test/edit/master/f/sources') + self.assertEqual(output.status_code, 200) + self.assertIn( + '
  • ' + '  master' + '
  • ' + '  sources
  • ', + output.data) + self.assertIn( + '', + output.data) + self.assertIn( + '', output.data + ) + def test_edit_file(self): """ Test the edit_file endpoint. """