mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 04:59:23 +08:00
18 lines
469 B
Python
18 lines
469 B
Python
import json
|
|
|
|
from flask import Response
|
|
|
|
from extensions.ext_login import unauthorized_handler
|
|
|
|
|
|
def test_unauthorized_handler_returns_json_response() -> None:
|
|
response = unauthorized_handler()
|
|
|
|
assert isinstance(response, Response)
|
|
assert response.status_code == 401
|
|
assert response.content_type == "application/json"
|
|
assert json.loads(response.get_data(as_text=True)) == {
|
|
"code": "unauthorized",
|
|
"message": "Unauthorized.",
|
|
}
|