19 lines
680 B
Python
19 lines
680 B
Python
from app.models import AppPolicy, RunMode, RuntimeRequest, SignBoxProfile
|
|
|
|
|
|
def test_profile_and_runtime_json_roundtrip() -> None:
|
|
profile = SignBoxProfile(name="Основная", config={"type": "vless"})
|
|
restored = SignBoxProfile.model_validate_json(profile.model_dump_json())
|
|
assert restored.id == profile.id
|
|
request = RuntimeRequest(
|
|
engine="signbox",
|
|
mode=RunMode.VPN,
|
|
profile_id=profile.id,
|
|
vpn={"app_rules": {"com.example.void": AppPolicy.VOID}},
|
|
)
|
|
assert (
|
|
RuntimeRequest.model_validate_json(request.model_dump_json()).vpn.app_rules[
|
|
"com.example.void"
|
|
]
|
|
is AppPolicy.VOID
|
|
)
|