Factorise token, skip period test

This commit is contained in:
Colin Goutte 2023-08-27 22:12:29 +02:00
parent 0b09021d5c
commit b985e7590a
2 changed files with 6 additions and 3 deletions

View File

@ -43,10 +43,12 @@ def get_all_movies(db: Session):
def search_movie(db: Session, term: str):
exp = f"%{term}%"
# Use regex instead ? still \W is had to escape
db_movie = db.query(models.Movie).where(
sqlalchemy.or_(
models.Movie.title.like(f"%{term}%"),
models.Movie.description.like(f"%{term}%"),
models.Movie.title.like(exp),
models.Movie.description.like(exp),
)
)

View File

@ -187,13 +187,14 @@ def test_search_movies_token():
def test_search_movies_token_period():
return
clear_db()
response = client.get("/movies/")
# assert response.json() == []
radix = rand_name()
title = radix + "test_search_title titletokenperiod."
title = radix + "test_search_title title3tokenperiod."
with db_context() as db:
movie_title = crud.create_movie(