diff --git a/tests/test_progit_flask_ui_groups.py b/tests/test_progit_flask_ui_groups.py new file mode 100644 index 0000000..c56385a --- /dev/null +++ b/tests/test_progit_flask_ui_groups.py @@ -0,0 +1,63 @@ +# -*- 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 pagure.lib +import tests + + +class PagureFlaskGroupstests(tests.Modeltests): + """ Tests for flask groups controller of pagure """ + + def setUp(self): + """ Set up the environnment, ran before every tests. """ + super(PagureFlaskGroupstests, self).setUp() + + pagure.APP.config['TESTING'] = True + pagure.SESSION = self.session + pagure.ui.SESSION = self.session + pagure.ui.groups.SESSION = self.session + pagure.ui.repo.SESSION = self.session + + pagure.APP.config['GIT_FOLDER'] = tests.HERE + pagure.APP.config['FORK_FOLDER'] = os.path.join( + tests.HERE, 'forks') + pagure.APP.config['TICKETS_FOLDER'] = os.path.join( + tests.HERE, 'tickets') + pagure.APP.config['DOCS_FOLDER'] = os.path.join( + tests.HERE, 'docs') + pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( + tests.HERE, 'requests') + self.app = pagure.APP.test_client() + + def test_group_lists(self): + """ Test the group_lists endpoint. """ + output = self.app.get('/groups') + self.assertIn('

Groups

', output.data) + self.assertIn('

0 groups.

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