fix: scoro and populate with apikey

This commit is contained in:
GitBluub
2023-12-02 13:36:46 +01:00
committed by Clément Le Bihan
parent 0a84c9daac
commit fe510e148a
3 changed files with 7 additions and 13 deletions

View File

@@ -26,10 +26,9 @@ from mido import MidiFile
import uuid
BACK_URL = os.environ.get("BACK_URL") or "http://back:3000"
r = requests.post(f"{BACK_URL}/auth/guest")
token = r.json()["access_token"]
API_KEY = os.environ.get("API_KEY_SCORO")
auth_header = {
"Authorization": f"Bearer {token}"
"Authorization": f"API Key {API_KEY}"
}
game_uuid = uuid.uuid4()

View File

@@ -1,8 +1,7 @@
#!/bin/bash
TOKEN=$(curl localhost:3000/auth/guest -X POST | jq -r '.access_token')
EMPTY_DB=$(curl localhost:3000/song/1 -s -H "Authorization: Bearer $TOKEN" | jq '.statusCode == 404')
EMPTY_DB=$(curl localhost:3000/song/1 -s -H "Authorization: API Key $API_KEY_SCORO_TEST" | jq '.statusCode == 404')
if [[ $EMPTY_DB == "true" ]]; then
curl localhost:3000/song -H "Authorization: Bearer $TOKEN" -X POST --data '{"name": "SCORO_TEST", "difficulties": {}, "midiPath": "/assets/musics/SCORO_TEST/SCORO_TEST.midi", "musicXmlPath": "/assets/musics/SCORO_TEST/SCORO_TEST.mxl"}' -H "Content-Type: application/json" &> /dev/null
curl localhost:3000/song -H "Authorization: API Key $API_KEY_SCORO_TEST" -X POST --data '{"name": "SCORO_TEST", "difficulties": {}, "midiPath": "/assets/musics/SCORO_TEST/SCORO_TEST.midi", "musicXmlPath": "/assets/musics/SCORO_TEST/SCORO_TEST.mxl"}' -H "Content-Type: application/json" &> /dev/null
fi
TESTS_DONE=0