diff --git a/tests/test_pagure_flask_api.py b/tests/test_pagure_flask_api.py index dc54ce5..18fd82c 100644 --- a/tests/test_pagure_flask_api.py +++ b/tests/test_pagure_flask_api.py @@ -33,6 +33,26 @@ import tests class PagureFlaskApitests(tests.SimplePagureTest): """ Tests for flask API controller of pagure """ + def test_api_doc(self): + """ Test the API documentation page. """ + output = self.app.get('/api/0/') + output_text = output.get_data(as_text=True) + self.assertIn( + ' API | pagure - Pagure\n', output_text) + self.assertIn( + '  Pagure API Reference\n \n', output_text) + + def test_api_doc_authenticated(self): + """ Test the API documentation page. """ + user = tests.FakeUser(username='foo') + with tests.user_set(self.app.application, user): + output = self.app.get('/api/0/') + output_text = output.get_data(as_text=True) + self.assertIn( + ' API | pagure - Pagure\n', output_text) + self.assertIn( + '  Pagure API Reference\n \n', output_text) + def test_api_get_request_data(self): data = {'foo': 'bar'} # test_request_context doesn't set flask.g, but some teardown