mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-08 20:30:59 +00:00
feat(cloud): harden multi-tenant runtime resources
This commit is contained in:
@@ -10,11 +10,28 @@ import pytest
|
||||
import base64
|
||||
|
||||
from langbot.pkg.utils.image import (
|
||||
decode_base64_limited,
|
||||
encode_base64,
|
||||
get_qq_image_downloadable_url,
|
||||
extract_b64_and_format,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_base64_media_helpers_round_trip_within_limit():
|
||||
encoded = await encode_base64(b'1234')
|
||||
|
||||
assert await decode_base64_limited(encoded, max_bytes=4) == b'1234'
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_base64_media_decode_rejects_oversized_payload():
|
||||
encoded = base64.b64encode(b'12345').decode()
|
||||
|
||||
with pytest.raises(ValueError, match='exceeds'):
|
||||
await decode_base64_limited(encoded, max_bytes=4)
|
||||
|
||||
|
||||
class TestGetQQImageDownloadableUrl:
|
||||
"""Tests for get_qq_image_downloadable_url function."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user