Skip to content

Commit

Permalink
add a test route with varying arguments
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Ramsay <[email protected]>
  • Loading branch information
seapagan committed Mar 30, 2024
1 parent f982112 commit 1a6ffa3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/live_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,13 @@ def cache_invalid_type(request: Request, response: Response) -> logging.Logger:
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
return logger


@app.get("/cache_with_args/{user}")
@cache_one_hour(tag="user_tag")
def cache_with_args(user: int) -> dict[str, Union[bool, str]]:
"""Have a varying cache key based on the user argument."""
return {
"success": True,
"message": f"this data is for user {user}",
}
10 changes: 10 additions & 0 deletions tests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,13 @@ def cache_invalid_type(request: Request, response: Response) -> logging.Logger:
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
return logger


@app.get("/cache_with_args/{user}")
@cache_one_hour(tag="user_tag")
def cache_with_args(user: int) -> dict[str, Union[bool, str]]:
"""Have a varying cache key based on the user argument."""
return {
"success": True,
"message": f"this data is for user {user}",
}

0 comments on commit 1a6ffa3

Please sign in to comment.