diff --git a/requirements.txt b/requirements.txt index 6e05310e..ddacba43 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,12 @@ # Add here external Python modules dependencies, one per line. Module names # should match https://pypi.python.org/pypi names. For the full spec or # dependency lines, see https://pip.readthedocs.org/en/1.1/requirements.html + +# Runtime dependencies Flask Flask-API swh.core swh.storage >= 0.0.19 + +# Test dependencies +Flask-Testing diff --git a/swh/web/ui/tests/test_views.py b/swh/web/ui/tests/test_views.py index 610a52b7..db6c70e7 100644 --- a/swh/web/ui/tests/test_views.py +++ b/swh/web/ui/tests/test_views.py @@ -1,43 +1,43 @@ # Copyright (C) 2015 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information -import unittest - from nose.tools import istest -from swh.web.ui.tests import test_app +from swh.web.ui import main +from flask.ext.testing import TestCase -class ViewsTestCase(unittest.TestCase): +class ViewsTestCase(TestCase): - @classmethod - def setUpClass(cls): - cls.app, _, _ = test_app.init_app() + def create_app(self): + app = main.app + app.config['TESTING'] = True + return app @istest def info(self): # when - rv = self.app.get('/about') + rv = self.client.get('/about') self.assertEquals(rv.status_code, 200) self.assertIn(b'About', rv.data) # @istest def search_1(self): # when - rv = self.app.get('/search') + rv = self.client.get('/search') self.assertEquals(rv.status_code, 200) # check this api self.assertRegexpMatches(rv.data, b'name=q value=>') # @istest def search_2(self): # when - rv = self.app.get('/search?q=one-hash-to-look-for:another-one') + rv = self.client.get('/search?q=one-hash-to-look-for:another-one') self.assertEquals(rv.status_code, 200) # check this api self.assertRegexpMatches( rv.data, b'name=q value=one-hash-to-look-for:another-one')