Skip to content

Commit

Permalink
tests: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ntarocco authored and lnielsen committed May 15, 2020
1 parent 4843813 commit 08a6cc6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
23 changes: 5 additions & 18 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')
2 changes: 1 addition & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_ng_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
6 changes: 3 additions & 3 deletions tests/test_rsk_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 08a6cc6

Please sign in to comment.