fix(gtea): test_admin_api: add token scopes for gitea 1.22+
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Gitea 1.22+ (including 1.24.2 on cc-ci) requires explicit scopes when creating API tokens. Add read:user + read:organization to satisfy the token creation endpoint and the read-back assertions that follow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -93,10 +93,11 @@ def test_admin_api_user_org_token_lifecycle(live_app):
|
||||
assert body.get("username") == test_org, f"unexpected org: {body}"
|
||||
|
||||
try:
|
||||
# 3. Create API token for test user (admin creates token on behalf of user)
|
||||
# 3. Create API token for test user (admin creates token on behalf of user).
|
||||
# Gitea 1.22+ requires explicit scopes; supply the minimum needed for steps 4-5.
|
||||
status, tok_body = _api(
|
||||
live_app, f"/users/{test_user}/tokens", method="POST",
|
||||
body={"name": token_name},
|
||||
body={"name": token_name, "scopes": ["read:user", "read:organization"]},
|
||||
user=adm_user, password=adm_pass,
|
||||
)
|
||||
assert status == 201, f"token create HTTP {status}: {tok_body}"
|
||||
|
||||
Reference in New Issue
Block a user