added first test

This commit is contained in:
Andrei Stoica 2022-09-18 13:01:33 -04:00
parent a87c0f142e
commit c6a75b59eb
1 changed files with 20 additions and 0 deletions

20
test/test_db.py Normal file
View File

@ -0,0 +1,20 @@
from sqlite3 import connect
from recipe_graph import db
from sqlalchemy.exc import SQLAlchemyError
import sqlalchemy
import pytest
@pytest.fixture
def engine() -> sqlalchemy.engine.Engine:
return db.get_engine()
def test_db_connection(engine):
connected = False
try:
engine.connect()
connected = True
except (SQLAlchemyError):
pass
finally:
assert(connected == True)