From 08a6cc6f58986d507fac0895eb66ce341451e166 Mon Sep 17 00:00:00 2001 From: Nicola Tarocco Date: Thu, 14 May 2020 17:42:47 +0200 Subject: [PATCH] tests: fix tests --- tests/conftest.py | 23 +++++------------------ tests/test_app.py | 2 +- tests/test_ng_templates.py | 6 +++--- tests/test_rsk_templates.py | 6 +++--- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 73c0202c..0b118dae 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -32,14 +32,15 @@ def instance_path(): shutil.rmtree(path) -def app(base_template, header_template): - """Flask application common fixture.""" +@pytest.fixture() +def app(): + """Flask application fixture.""" app = Flask('testapp') app.config.update( TESTING=True, SEARCH_UI_SEARCH_API='api', - BASE_TEMPLATE=base_template, - HEADER_TEMPLATE=header_template, + BASE_TEMPLATE='invenio_search_ui/base.html', + HEADER_TEMPLATE='invenio_search_ui/base_header.html', ) Babel(app) InvenioAssets(app) @@ -60,17 +61,3 @@ def api(): # override default app jinja_loader to add the new path app.jinja_loader = enhanced_jinja_loader return app - - -@pytest.fixture() -def app_ng(): - """Flask application fixture for the AngularJS/Bootstrap3 app.""" - return app('invenio_search_ui/base.html', - 'invenio_search_ui/base_header.html') - - -@pytest.fixture() -def app_rsk(): - """Flask application fixture for the React/Semantic-UI app.""" - return app('invenio_search_ui/base.html', - 'invenio_search_ui/base_header.html') diff --git a/tests/test_app.py b/tests/test_app.py index 05f8a1c6..0b639f19 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -22,7 +22,7 @@ def test_version(): assert __version__ -def test_init(app_ng): +def test_init(): """Test extension initialization.""" app = Flask('testapp') InvenioSearchUI(app) diff --git a/tests/test_ng_templates.py b/tests/test_ng_templates.py index 87deee5b..08cdd8a7 100644 --- a/tests/test_ng_templates.py +++ b/tests/test_ng_templates.py @@ -34,13 +34,13 @@ def _check_template(): assert 'invenio-search-range' in rendered -def test_view(app_ng): +def test_view(app): """Test view.""" - with app_ng.test_request_context(): + with app.test_request_context(): _check_template() -def test_format_sortoptions(app_ng): +def test_format_sortoptions(app): """Test default sort option filter.""" sort_options = dict( test1=dict(order=2, title='Test1', default_order='desc'), diff --git a/tests/test_rsk_templates.py b/tests/test_rsk_templates.py index c734fa1d..ac3ebf23 100644 --- a/tests/test_rsk_templates.py +++ b/tests/test_rsk_templates.py @@ -30,13 +30,13 @@ def _check_template(): assert 'id="search-ui-app"' in rendered -def test_view(app_rsk): +def test_view(app): """Test view.""" - with app_rsk.test_request_context(): + with app.test_request_context(): _check_template() -def test_format_sortoptions(app_rsk): +def test_format_sortoptions(app): """Test default sort option filter.""" sort_options = dict( test1=dict(order=2, title="Test 1", default_order="desc"),