fix: clarify New-API authentication failures
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from app.services.upstream_client import UpstreamClient
|
||||
import pytest
|
||||
|
||||
from app.services.upstream_client import UpstreamClient, UpstreamError
|
||||
|
||||
|
||||
def test_new_api_token_headers_include_authorization_and_new_api_user():
|
||||
@@ -16,6 +18,18 @@ def test_new_api_token_headers_include_authorization_and_new_api_user():
|
||||
assert "Nox-Api-User" not in headers
|
||||
|
||||
|
||||
def test_new_api_token_rejects_dashboard_jwt():
|
||||
client = UpstreamClient(
|
||||
base_url="http://newapi.local",
|
||||
api_prefix="",
|
||||
auth_type="new_api_token",
|
||||
auth_config={"token": "a" * 1200 + ".payload.signature", "user_id": "7"},
|
||||
)
|
||||
|
||||
with pytest.raises(UpstreamError, match="面板登录 JWT"):
|
||||
client._headers()
|
||||
|
||||
|
||||
def test_nox_token_headers_include_authorization_and_nox_api_user():
|
||||
client = UpstreamClient(
|
||||
base_url="http://nox.local",
|
||||
|
||||
Reference in New Issue
Block a user