Skip to content

Commit

Permalink
Add test endpoint to change SQL echoing live.
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-jvessella committed Apr 5, 2024
1 parent 4c2bf78 commit 63eba69
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gamebrain/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,18 @@ async def test_get_settings() -> SettingsModel:
return get_settings()


@test_router.get("/settings/echo_sql/{state}")
async def test_change_echo_sql(state: bool) -> None:
# Dirty workaround to avoid having to re-init the DB engine
# or dig through its source to figure out how to change
# the setting.
if state:
level = logging.INFO
else:
level = logging.NOTSET
logging.getLogger("sqlalchemy.engine").setLevel(level)


@test_router.get("/current_state")
async def test_get_current_state() -> GameDataCacheSnapshot:
snapshot = await GameStateManager.snapshot_data()
Expand Down

0 comments on commit 63eba69

Please sign in to comment.