mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 04:01:32 -06:00
Test: introduce test for every game has a tutorial (#478)
This commit is contained in:
13
WebHost.py
13
WebHost.py
@@ -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__":
|
||||
|
Reference in New Issue
Block a user