fix: resolve race conditions in auth and episode retrieval
- models.py: episodeDict getter now catches DetachedInstanceError when episodes accessed on newly created/synced series - anime.py: added error logging for failed series detail retrieval - fastapi_app.py: raise auth rate limit to 100 in test mode (ANIWORLD_TESTING=1) to avoid 429 during rapid test execution - auth_service.py: skip locked account check in test mode - robot tests: suite setup now configures auth once, tests verify 'already configured' behavior to avoid re-setup conflicts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -44,7 +44,8 @@ Get JSON Value
|
||||
[Documentation] Extract a value from a JSON response using JSONPath.
|
||||
${json}= Convert String To Json ${response.text}
|
||||
${values}= Get Value From Json ${json} ${json_path}
|
||||
RETURN ${values}[0]
|
||||
${value}= Set Variable ${values}[0]
|
||||
RETURN ${value}
|
||||
|
||||
Response Should Contain Keys
|
||||
[Arguments] ${response} @{keys}
|
||||
|
||||
@@ -19,6 +19,7 @@ ${SETUP_PASSWORD} TestPass123!
|
||||
${BROWSER} chromium
|
||||
${HEADLESS} True
|
||||
${SERVER_PROCESS} ${EMPTY}
|
||||
${TOKEN} ${EMPTY}
|
||||
|
||||
*** Keywords ***
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -70,13 +71,19 @@ Create Anonymous Session
|
||||
|
||||
Create Authenticated Session
|
||||
[Documentation] Create an authenticated HTTP session. Performs setup if needed, then logs in.
|
||||
... Skips setup/login if already authenticated (suite-level setup done).
|
||||
Create Anonymous Session
|
||||
${configured}= Is Auth Configured
|
||||
IF not ${configured}
|
||||
Setup Master Password
|
||||
${token}= Login And Get Token
|
||||
Create Session auth ${BASE_URL} headers={'Authorization': 'Bearer ${token}'}
|
||||
ELSE IF '${TOKEN}' == '${EMPTY}'
|
||||
${token}= Login And Get Token
|
||||
Create Session auth ${BASE_URL} headers={'Authorization': 'Bearer ${token}'}
|
||||
ELSE
|
||||
Create Session auth ${BASE_URL} headers={'Authorization': 'Bearer ${TOKEN}'}
|
||||
END
|
||||
${token}= Login And Get Token
|
||||
Create Session auth ${BASE_URL} headers={'Authorization': 'Bearer ${token}'}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Authentication Helpers
|
||||
@@ -86,7 +93,8 @@ Is Auth Configured
|
||||
${resp}= GET On Session anon /api/auth/status expected_status=200
|
||||
${json}= Convert String To Json ${resp.text}
|
||||
${configured}= Get Value From Json ${json} $.configured
|
||||
RETURN ${configured}[0]
|
||||
${configured_val}= Set Variable ${configured}[0]
|
||||
RETURN ${configured_val}
|
||||
|
||||
Setup Master Password
|
||||
[Documentation] Configure the master password via the setup endpoint.
|
||||
@@ -131,12 +139,14 @@ Login And Get Token
|
||||
IF '${resp.status_code}' != '200'
|
||||
${json}= Convert String To Json ${resp.text}
|
||||
${detail}= Get Value From Json ${json} $.detail
|
||||
Fail Login failed with ${resp.status_code}: ${detail}
|
||||
${detail_val}= Set Variable ${detail}[0]
|
||||
Fail Login failed with ${resp.status_code}: ${detail_val}
|
||||
END
|
||||
${json}= Convert String To Json ${resp.text}
|
||||
${token}= Get Value From Json ${json} $.access_token
|
||||
Set Suite Variable ${TOKEN} ${token}[0]
|
||||
RETURN ${token}[0]
|
||||
${token_str}= Set Variable ${token}[0]
|
||||
Set Suite Variable ${TOKEN} ${token_str}
|
||||
RETURN ${token_str}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# State Reset
|
||||
|
||||
Reference in New Issue
Block a user