Test: introduce test for every game has a tutorial (#478)

This commit is contained in:
Fabian Dill
2022-05-03 22:14:03 +02:00
committed by GitHub
parent 76663f819b
commit 7fad0b0f51
6 changed files with 40 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
import os
import multiprocessing
import logging
import typing
import ModuleUpdate
@@ -36,13 +37,19 @@ def get_app():
return app
def create_ordered_tutorials_file():
def create_ordered_tutorials_file() -> typing.List[typing.Dict[str, typing.Any]]:
import json
with open(os.path.join("WebHostLib", "static", "assets", "tutorial", "tutorials.json")) as source:
with open(Utils.local_path("WebHostLib", "static", "assets", "tutorial", "tutorials.json")) as source:
data = json.load(source)
data = sorted(data, key=lambda entry: entry["gameTitle"].lower())
with open(os.path.join("WebHostLib", "static", "generated", "tutorials.json"), "w") as target:
folder = Utils.local_path("WebHostLib", "static", "generated")
os.makedirs(folder, exist_ok=True)
with open(os.path.join(folder, "tutorials.json"), "w") as target:
json.dump(data, target)
return data
if __name__ == "__main__":