Feat: add e2e test for api

This commit is contained in:
2022-12-28 07:47:35 +01:00
parent 4a16444835
commit ccf1655cf4
8 changed files with 210 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ from backend.repository.tribe_sqlite_repository import TribeSQLiteRepository
# session = sessionmaker(bind=engine)()
# tribe_repo = TribeSQLAlchemyRepository(session)
conn = sqlite3.connect(":memory:")
conn = sqlite3.connect("sqlite.db")
create_db(conn)
tribe_repo = TribeSQLiteRepository(conn)

16
backend/config.py Normal file
View File

@@ -0,0 +1,16 @@
import os
import sqlite3
from backend.adapters.sqlite import create_db
def sqlite_conn(sqlite_file: str = ":memory"):
conn = sqlite3.connect(sqlite_file)
create_db(conn)
return conn
def get_api_url():
host = os.environ.get("API_HOST", "localhost")
port = 8000 if host == "localhost" else 80
return f"http://{host}:{port}"