added first test
This commit is contained in:
20
test/test_db.py
Normal file
20
test/test_db.py
Normal 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)
|
||||
Reference in New Issue
Block a user