From c25c8bc4fbb7a671d5623db5adf2aac32a31e81c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 04 2015 08:32:16 +0000 Subject: Add unit-tests for the docs of project that disabled their doc --- diff --git a/tests/test_progit_flask_ui_docs.py b/tests/test_progit_flask_ui_docs.py index fb8c028..9b6fb69 100644 --- a/tests/test_progit_flask_ui_docs.py +++ b/tests/test_progit_flask_ui_docs.py @@ -66,6 +66,29 @@ class ProgitFlaskDocstests(tests.Modeltests): '
  • No docs repository could be found, please ' 'contact an admin
  • ' in output.data) + def test_view_docs_project_no_docs(self): + """ Test the view_docs endpoint with a project that disabled the + docs. + """ + tests.create_projects(self.session) + repo = progit.lib.get_project(self.session, 'test') + tests.create_projects_git(os.path.join(tests.HERE, 'docs')) + + output = self.app.get('/test/docs') + self.assertEqual(output.status_code, 200) + self.assertTrue('

    Docs

    ' in output.data) + self.assertTrue('

    This repo is brand new!

    ' in output.data) + self.assertTrue( + 'git clone git@progit.fedorahosted.org:docs/test.git' + in output.data) + + repo.project_docs = False + self.session.add(repo) + self.session.commit() + + output = self.app.get('/test/docs', follow_redirects=True) + self.assertEqual(output.status_code, 404) + if __name__ == '__main__': SUITE = unittest.TestLoader().loadTestsFromTestCase(ProgitFlaskDocstests)