Cache scoreboard page (#1025)

* Cache the `/scoreboard` page to avoid having to rebuild the response so often
* Update `tests.api.v1.test_scoreboard:test_scoreboard_is_cached` to also test if `/scoreboard` is cached
This commit is contained in:
Kevin Chung
2019-06-16 13:29:50 -04:00
committed by GitHub
parent e627391b12
commit b5632f9289
3 changed files with 9 additions and 0 deletions

View File

@@ -39,8 +39,14 @@ def test_scoreboard_is_cached():
client.get("/api/v1/scoreboard/top/10")
assert app.cache.get("view/api.scoreboard_scoreboard_detail")
# Check scoreboard page
assert app.cache.get('view/scoreboard.listing') is None
client.get("/scoreboard")
assert app.cache.get('view/scoreboard.listing')
# Empty standings and check that the cached data is gone
clear_standings()
assert app.cache.get("view/api.scoreboard_scoreboard_list") is None
assert app.cache.get("view/api.scoreboard_scoreboard_detail") is None
assert app.cache.get('view/scoreboard.listing') is None
destroy_ctfd(app)