Skip to content

Commit

Permalink
Remove redundant test
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Sep 12, 2023
1 parent 9e76ede commit 946c8fa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
5 changes: 0 additions & 5 deletions gilda/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from gilda.grounder import GrounderInput, Grounder
from gilda.app.proxies import grounder

GILDA_USING_UI = "GILDA_USING_UI"

# NOTE: the Flask REST-X API has to be declared here, below the home endpoint
# otherwise it reserves the / base path.

Expand Down Expand Up @@ -289,16 +287,13 @@ def get_app(terms: Optional[GrounderInput] = None, *, ui: bool = True) -> Flask:
else:
Bootstrap(app)
app.register_blueprint(ui_blueprint, url_prefix="/")
app.config[GILDA_USING_UI] = True

# has to be put after defining the UI blueprint otherwise it reserves "/"
api.init_app(app)
return app


def _mount_home_redirect(app):
app.config[GILDA_USING_UI] = False

@app.route("/")
def home_redirect():
"""Redirect the home url to the API documentation."""
Expand Down
4 changes: 1 addition & 3 deletions gilda/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import flask

from gilda.app.app import get_app, GILDA_USING_UI
from gilda.app.app import get_app


class TestApp(unittest.TestCase):
Expand All @@ -19,7 +19,6 @@ def setUpClass(cls) -> None:

def test_get_home(self):
"""Test the GET response on the home page."""
self.assertTrue(self.app.config[GILDA_USING_UI])
with self.app.test_client() as client:
res = client.get("/?text=Raf1")
self.assertNotEqual(
Expand All @@ -31,7 +30,6 @@ def test_get_home(self):

def test_post_home(self):
"""Test the POST response on the home page."""
self.assertTrue(self.app.config[GILDA_USING_UI])
with self.app.test_client() as client:
res = client.post("/", json={"text": "Raf1"})
self.assertNotEqual(
Expand Down

0 comments on commit 946c8fa

Please sign in to comment.