Skip to content

Commit

Permalink
test(leftovers): add tests to hit uncovered code (#235)
Browse files Browse the repository at this point in the history
test(leftovers): add tests to hit uncovered code
  • Loading branch information
callenmacphee committed Aug 14, 2019
1 parent 4e0b2c5 commit b9519ac
Show file tree
Hide file tree
Showing 5 changed files with 420 additions and 14 deletions.
12 changes: 4 additions & 8 deletions indexd/dos/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,22 @@ def indexd_to_dos(record):

@blueprint.errorhandler(UserError)
def handle_user_error(err):
ret = {msg: str(err), status_code: 0}
return flask.jsonify(ret), 400
return flask.jsonify(error=str(err)), 400


@blueprint.errorhandler(AuthError)
def handle_auth_error(err):
ret = {msg: str(err), status_code: 0}
return flask.jsonify(ret), 403
return flask.jsonify(error=str(err)), 403


@blueprint.errorhandler(AliasNoRecordFound)
def handle_no_alias_record_error(err):
ret = {msg: str(err), status_code: 0}
return flask.jsonify(ret), 404
return flask.jsonify(error=str(err)), 404


@blueprint.errorhandler(IndexNoRecordFound)
def handle_no_index_record_error(err):
ret = {msg: str(err), status_code: 0}
return flask.jsonify(ret), 404
return flask.jsonify(error=str(err)), 404


@blueprint.record
Expand Down
4 changes: 2 additions & 2 deletions indexd/index/drivers/query/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def query_urls(
Returns:
list: result list
"""
pass
raise NotImplementedError("TODO")

@abstractmethod
def query_metadata_by_key(
Expand All @@ -55,4 +55,4 @@ def query_metadata_by_key(
Returns:
list: result list
"""
pass
raise NotImplementedError("TODO")
8 changes: 5 additions & 3 deletions indexd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ def hint_match(record, hints):
from sqlalchemy.engine.reflection import Inspector


def try_drop_test_data(user, database, root_user="postgres", host=""):
def try_drop_test_data(
user, database, root_user="postgres", host=""
): # pragma: no cover

engine = create_engine(
"postgres://{user}@{host}/postgres".format(user=root_user, host=host)
Expand All @@ -39,7 +41,7 @@ def setup_database(
host="",
no_drop=False,
no_user=False,
):
): # pragma: no cover
"""
setup the user and database
"""
Expand Down Expand Up @@ -77,7 +79,7 @@ def setup_database(
conn.close()


def create_tables(host, user, password, database):
def create_tables(host, user, password, database): # pragma: no cover
"""
create tables
"""
Expand Down
Loading

0 comments on commit b9519ac

Please sign in to comment.