Buckets:

download
raw
1 kB
"""Sandbox JWT minting."""
from __future__ import annotations
from unittest.mock import MagicMock, patch
from hof.agent.sandbox.token import mint_sandbox_bearer_token
def test_mint_returns_none_without_jwt_secret() -> None:
cfg = MagicMock()
cfg.jwt_secret_key = ""
cfg.admin_username = "admin"
cfg.user_roles = {}
cfg.jwt_algorithm = "HS256"
cfg.jwt_access_token_expire_minutes = 60
with patch("hof.config.get_config", return_value=cfg):
assert mint_sandbox_bearer_token() is None
def test_mint_returns_jwt_when_secret_set() -> None:
cfg = MagicMock()
cfg.jwt_secret_key = "test-secret-at-least-16-bytes"
cfg.admin_username = "admin"
cfg.user_roles = {"admin": ["admin"]}
cfg.jwt_algorithm = "HS256"
cfg.jwt_access_token_expire_minutes = 60
with patch("hof.config.get_config", return_value=cfg):
tok = mint_sandbox_bearer_token()
assert tok is not None
assert isinstance(tok, str)
assert tok.count(".") == 2

Xet Storage Details

Size:
1 kB
·
Xet hash:
6f3d94cd54cb6ff83a741f3adee9a9bc77e6333621f36ff0dd986a512187a974

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.