Modify the query tests to match the test DB
This commit is contained in:
parent
1dd62e1ae0
commit
9638037ece
|
@ -1,5 +1,5 @@
|
|||
from pydantic import BaseModel, EmailStr
|
||||
from fastapi import Query
|
||||
from pydantic import BaseModel, EmailStr
|
||||
|
||||
|
||||
class RegisterSchema(BaseModel):
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
from constants import DB
|
||||
from databases import Database
|
||||
from sqlalchemy import MetaData, create_engine
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from databases import Database
|
||||
|
||||
from constants import DB
|
||||
|
||||
metadata = MetaData()
|
||||
engine = create_engine(DB)
|
||||
engine = create_engine(DB, connect_args={"check_same_thread": False})
|
||||
metadata.create_all(engine)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
Base = declarative_base()
|
||||
database = Database(DB)
|
||||
|
||||
from database import models
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from datetime import datetime
|
||||
from pydoc import locate
|
||||
|
||||
from app import app
|
||||
from app.schemas import *
|
||||
from database import database
|
||||
from pydoc import locate
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
|
|
|
@ -17,9 +17,8 @@ mkShell {
|
|||
python38Packages.twilio
|
||||
sqlite
|
||||
# Development tools
|
||||
python38Packages.black
|
||||
black
|
||||
python38Packages.isort
|
||||
python38Packages.pyflakes
|
||||
python-language-server
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,74 +1,72 @@
|
|||
from database.models import *
|
||||
from datetime import datetime
|
||||
|
||||
from database import SessionLocal
|
||||
from database.models import *
|
||||
|
||||
db = SessionLocal()
|
||||
|
||||
|
||||
def test_users():
|
||||
deepak = Users.query.filter_by(id=46).first()
|
||||
assert deepak.email == "deepak@yopmail.com"
|
||||
test = db.query(Users).filter(Users.id == 260).first()
|
||||
assert test.email == "testaccountjugador@gmail.com"
|
||||
|
||||
|
||||
def test_cities():
|
||||
beirut = Cities.query.filter_by(id=12).first()
|
||||
assert beirut.name == "Beirut"
|
||||
test = db.query(Cities).filter(Cities.id == 7).first()
|
||||
assert test.name == "Lyon"
|
||||
|
||||
|
||||
def test_games():
|
||||
test = Games.query.filter_by(id=63).first()
|
||||
assert test.user_id == 255
|
||||
test = db.query(Games).filter(Games.id == 508).first()
|
||||
assert test.user_id == 1987
|
||||
|
||||
|
||||
def test_payments():
|
||||
test = Payments.query.filter_by(id=295).first()
|
||||
assert test.user_id == 260
|
||||
test = db.query(Payments).filter(Payments.id == 375).first()
|
||||
assert test.user_id == 88
|
||||
|
||||
|
||||
def test_player_availabilities():
|
||||
test = PlayerAvailabilities.query.filter_by(id=256).first()
|
||||
assert test.game_id == 94
|
||||
test = db.query(PlayerAvailabilities).filter(PlayerAvailabilities.id == 248).first()
|
||||
assert test.game_id == 89
|
||||
|
||||
|
||||
def test_player_cancel_games():
|
||||
test = PlayerCancelGames.query.filter_by(id=132).first()
|
||||
assert test.player_id == 137
|
||||
test = db.query(PlayerCancelGames).filter(PlayerCancelGames.id == 67).first()
|
||||
assert test.player_id == 44
|
||||
|
||||
|
||||
def test_purchase_games():
|
||||
test = PurchaseGames.query.filter_by(id=268).first()
|
||||
assert test.game_id == 64
|
||||
test = db.query(PurchaseGames).filter(PurchaseGames.id == 235).first()
|
||||
assert test.game_id == 50
|
||||
|
||||
|
||||
def test_sports():
|
||||
test = Sports.query.filter_by(id=4).first()
|
||||
test = db.query(Sports).filter(Sports.id == 4).first()
|
||||
assert test.name == "Volleyball"
|
||||
|
||||
|
||||
def test_teams():
|
||||
test = Teams.query.filter_by(id=306).first()
|
||||
test = db.query(Teams).filter(Teams.id == 306).first()
|
||||
assert test.game_id == 64
|
||||
|
||||
|
||||
def test_user_ratings():
|
||||
test = UserRatings.query.filter_by(id=420).first()
|
||||
assert test.user_id == 21
|
||||
test = db.query(UserRatings).filter(UserRatings.id == 287).first()
|
||||
assert test.user_id == 60
|
||||
|
||||
|
||||
def test_venue_images():
|
||||
test = VenueImages.query.filter_by(id=6).first()
|
||||
date = datetime(year=2019, month=7, day=28, hour=14, minute=1, second=21)
|
||||
assert test.updated == date
|
||||
|
||||
|
||||
def test_venues():
|
||||
test = Venues.query.filter_by(id=28).first()
|
||||
assert test.name == "Santiago Bernabéu"
|
||||
|
||||
|
||||
def test_view_news():
|
||||
test = ViewNews.query.filter_by(id=57).first()
|
||||
date = datetime(year=2019, month=7, day=16, hour=11, minute=32, second=16)
|
||||
test = db.query(VenueImages).filter(VenueImages.id == 3).first()
|
||||
date = datetime(year=2019, month=6, day=3, hour=5, minute=43, second=22)
|
||||
assert test.created == date
|
||||
|
||||
|
||||
def test_venues():
|
||||
test = db.query(Venues).filter(Venues.id == 26).first()
|
||||
assert test.name == "Le tuto "
|
||||
|
||||
|
||||
def test_web_bookings():
|
||||
test = WebBookings.query.filter_by(id=9).first()
|
||||
assert test.game == "Fútbol "
|
||||
test = db.query(WebBookings).filter(WebBookings.id == 7).first()
|
||||
assert test.game == "Soccer"
|
||||
|
|
Loading…
Reference in New Issue