a9c16febf4
* test(skills): align sandbox cache tests with readonly behavior * ci(release): enforce core quality gate before publish * ci: enforce locked dependency installs in workflows * security: remove curl-pipe-shell installs * chore: align project python baseline to 3.12 * ci(dashboard): add explicit typecheck gate * chore(pre-commit): align ruff hook version with project * ci(codeql): add javascript-typescript analysis * chore(ruff): defer py312 migration lint rules * fix: resolve ruff violations without new ignores * fix: resolve ASYNC230 and ASYNC240 without ignores * fix(auth): replace utcnow with timezone-aware UTC now * fix: avoid blocking file read in file_to_base64
17 lines
393 B
Python
17 lines
393 B
Python
import base64
|
|
|
|
import pytest
|
|
|
|
from astrbot.core.utils.io import file_to_base64
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_file_to_base64_reads_file_async(tmp_path):
|
|
sample_file = tmp_path / "sample.bin"
|
|
sample_file.write_bytes(b"astrbot")
|
|
|
|
result = await file_to_base64(str(sample_file))
|
|
|
|
expected = "base64://" + base64.b64encode(b"astrbot").decode()
|
|
assert result == expected
|