示例#1
0
async def home(request: Request, db: Session = Depends(get_db)):
    quote = daily_quotes.get_quote_of_day(db)
    return templates.TemplateResponse(
        "index.html",
        {
            "request": request,
            "quote": quote,
        },
    )
示例#2
0
def test_get_quote_of_day_get_first_quote(session, quote1, quote2):
    assert daily_quotes.get_quote_of_day(
        session, DATE).text == quote1.text
示例#3
0
def test_get_quote_of_day_get_second_quote(session, quote1, quote2):
    assert daily_quotes.get_quote_of_day(
        session, DATE2).text == quote2.text
示例#4
0
def test_get_quote_of_day_no_quotes(session):
    assert daily_quotes.get_quote_of_day(session, DATE) is None