diff --git a/Makefile b/Makefile index 55a280e..9f11cfb 100644 --- a/Makefile +++ b/Makefile @@ -24,10 +24,7 @@ uninstall: test: # Unit tests with coverage report - coverage erase - coverage run --rcfile=./.coveragerc -m pytest -c tests - coverage report --rcfile=./.coveragerc - coverage html --rcfile=./.coveragerc + pytest --cov=./tests check: flake8 fastapi_hive/ --select=E9,F63,F7,F82 diff --git a/example/cornerstone/db/implement.py b/example/cornerstone/db/implement.py index 7ea13c2..1c4f677 100644 --- a/example/cornerstone/db/implement.py +++ b/example/cornerstone/db/implement.py @@ -1,7 +1,7 @@ from sqlalchemy import create_engine -from sqlalchemy.orm import declarative_base +from sqlalchemy.ext.declarative import declarative_base from fastapi import FastAPI from example.cornerstone.config import DATABASE_URL from fastapi_sqlalchemy import DBSessionMiddleware # middleware helper diff --git a/tests/test_api/test_api_auth.py b/tests/test_api/test_api_auth.py index 6353d84..24ad14f 100644 --- a/tests/test_api/test_api_auth.py +++ b/tests/test_api/test_api_auth.py @@ -4,14 +4,14 @@ def test_auth_using_prediction_api_no_apikey_header(test_client) -> None: - response = test_client.post('/api/endpoints_package1/house_price/predict') + response = test_client.post('/api/house_price/predict') assert response.status_code == 400 assert response.json() == {"detail": messages.NO_API_KEY} def test_auth_using_prediction_api_wrong_apikey_header(test_client) -> None: response = test_client.post( - '/api/endpoints_package1/house_price/predict', + '/api/house_price/predict', json={"image": "test"}, headers={"token": "WRONG_TOKEN"} ) diff --git a/tests/test_api/test_heartbeat.py b/tests/test_api/test_heartbeat.py index 1ad13ab..559eefc 100644 --- a/tests/test_api/test_heartbeat.py +++ b/tests/test_api/test_heartbeat.py @@ -6,7 +6,7 @@ def test_heartbeat(test_client) -> None: - response = test_client.get('/api/endpoints_package1/heart_beat/heartbeat') + response = test_client.get('/api/heart_beat/heartbeat') assert response.status_code == 200 assert response.json() == {"is_alive": True} diff --git a/tests/test_api/test_prediction.py b/tests/test_api/test_prediction.py index d7378dd..03a3f88 100644 --- a/tests/test_api/test_prediction.py +++ b/tests/test_api/test_prediction.py @@ -5,7 +5,7 @@ def test_prediction(test_client) -> None: response = test_client.post( - "/api/endpoints_package1/house_price/predict", + "/api/house_price/predict", json={ "median_income_in_block": 8.3252, "median_house_age_in_block": 41, @@ -25,7 +25,7 @@ def test_prediction(test_client) -> None: def test_prediction_nopayload(test_client) -> None: response = test_client.post( - "/api/endpoints_package1/house_price/predict", + "/api/house_price/predict", json={}, headers={"token": str(config.API_KEY)} )