Skip to content
Snippets Groups Projects
Commit 428293ae authored by Antoine Gaudron-Desjardins's avatar Antoine Gaudron-Desjardins
Browse files

fix

parent 67fab5b2
No related branches found
No related tags found
1 merge request!59add test to ci
from fastapi.testclient import TestClient
from datetime import datetime, timedelta
from sqlalchemy import create_engine
from dotenv import load_dotenv
import pytz
from db import models
from main import app
import os
client = TestClient(app)
......@@ -22,6 +26,20 @@ test = {
}
def init_connection_bdd():
load_dotenv()
user = os.getenv('MYSQL_USER')
password = os.getenv('MYSQL_PASSWORD')
host = os.getenv('DB_HOST')
port = os.getenv('DB_PORT')
database = os.getenv('MYSQL_DATABASE')
SQLALCHEMY_DATABASE_URL = f"mysql+pymysql://{user}:{password}@{host}:{port}/{database}?charset=utf8"
engine = create_engine(SQLALCHEMY_DATABASE_URL)
models.Base.metadata.create_all(bind=engine)
def test_post_opening_hours():
response = client.post(
"/api/opening_hours",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment