Пример #1
0
def get_user(request: Request) -> t.Optional[User]:
    """Never to be called directly, exposes request.user."""
    return User.by_id(request.authenticated_userid, db=request.db)
Пример #2
0
def test_by_shortcuts(db: Session, democontent: None) -> None:
    """Test that by_* shortcuts work."""
    assert User.by_username("one", db) == User.by_email("*****@*****.**", db)
    assert User.by_username("one", db) == User.by_id(USER_ONE_ID, db)