From cfad1312d67746e6d7f330df68bb434a6a1d5480 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 02 2015 13:59:50 +0000 Subject: Start working on the unit-tests for the flask application/frontend --- diff --git a/tests/test_progit_flask_ui_app.py b/tests/test_progit_flask_ui_app.py new file mode 100644 index 0000000..9cdb830 --- /dev/null +++ b/tests/test_progit_flask_ui_app.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +""" + (c) 2015 - Copyright Red Hat Inc + + Authors: + Pierre-Yves Chibon + +""" + +__requires__ = ['SQLAlchemy >= 0.8'] +import pkg_resources + +import unittest +import shutil +import sys +import os + +import json +from mock import patch + +sys.path.insert(0, os.path.join(os.path.dirname( + os.path.abspath(__file__)), '..')) + +import progit.lib +import tests + + +class ProgitFlaskApptests(tests.Modeltests): + """ Tests for flask app of progit """ + + def setUp(self): + """ Set up the environnment, ran before every tests. """ + super(ProgitFlaskApptests, self).setUp() + + progit.APP.config['TESTING'] = True + progit.SESSION = self.session + progit.ui.SESSION = self.session + self.app = progit.APP.test_client() + + def test_index(self): + """ Test the index endpoint. """ + + output = self.app.get('/') + self.assertEqual(output.status_code, 200) + self.assertTrue('

All Projects (2)

' in output.data) + + +if __name__ == '__main__': + SUITE = unittest.TestLoader().loadTestsFromTestCase(ProgitFlaskApptests) + unittest.TextTestRunner(verbosity=2).run(SUITE)