Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #73 from openstax/ping_route
Browse files Browse the repository at this point in the history
Added home and ping routes
  • Loading branch information
Dantemss authored Nov 8, 2019
2 parents bfb92c8 + 696c351 commit 537d619
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
11 changes: 11 additions & 0 deletions sparfa_server/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ def jsonify_exception(code, exception):
for code, exception in default_exceptions.items():
application.errorhandler(exception)(partial(jsonify_exception, code))


@application.route('/')
def home():
return 'Biglearn SPARFA'


@application.route('/ping')
def ping():
return ''


application.errorhandler(JsonSchemaException)(partial(jsonify_exception, 400))

application.register_blueprint(blueprint)
6 changes: 0 additions & 6 deletions tests/unit/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
from sparfa_server.orm import EcosystemMatrix, Response, transaction


def test_root_not_found(flask):
response = flask.get('/')
assert response.status_code == 404
assert 'not found' in response.json['errors'][0]


def test_fetch_ecosystem_matrices_get_not_allowed(flask):
response = flask.get('/fetch_ecosystem_matrices')
assert response.status_code == 405
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/test_flask.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def test_root(flask):
response = flask.get('/')
assert response.status_code == 200
assert response.get_data(as_text=True) == 'Biglearn SPARFA'


def test_ping(flask):
response = flask.get('/ping')
assert response.status_code == 200
assert not response.get_data()

0 comments on commit 537d619

Please sign in to comment.