fix: scoro test maybe

This commit is contained in:
GitBluub
2023-11-15 14:00:12 +01:00
committed by Clément Le Bihan
parent c113b70fee
commit e5fb1dfb7e
+9 -1
View File
@@ -25,6 +25,11 @@ from chroma_case.song_check import getPartition
from mido import MidiFile from mido import MidiFile
import uuid import uuid
r = requests.post(f"{BACK_URL}/auth/guest")
token = r.json()["access_token"]
auth_header = {
"Authorization": f"Bearer {token}"
}
game_uuid = uuid.uuid4() game_uuid = uuid.uuid4()
testing = os.environ.get("SCORO_TEST") testing = os.environ.get("SCORO_TEST")
@@ -338,6 +343,7 @@ class Scorometer:
"info": self.info, "info": self.info,
"difficulties": self.difficulties, "difficulties": self.difficulties,
}, },
headers=auth_header
) )
exit() exit()
@@ -360,8 +366,10 @@ def handleStartMessage(start_message: StartMessage):
exit() exit()
try: try:
r = requests.get(f"{BACK_URL}/song/{song_id}") r = requests.get(f"{BACK_URL}/song/{song_id}", headers=auth_header)
r.raise_for_status() r.raise_for_status()
# Delete the guest account after getting song
requests.delete(f"{BACK_URL}/auth/me", headers=auth_header)
song_path = r.json()["midiPath"] song_path = r.json()["midiPath"]
song_path = song_path.replace("/assets/musics/", MUSICS_FOLDER) song_path = song_path.replace("/assets/musics/", MUSICS_FOLDER)
except Exception as e: except Exception as e: