mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-20 06:19:17 +08:00
* feat: minimal layout, user email, KB text docs, and remote desktop hub Add classic/minimal chrome with a unified chat records host, optional user email (invite/login), in-app markdown/txt knowledge editing, and a combined remote desktop/phone control surface—plus host path and mobile setup hardening. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(host_dirs): don't jail host-root browse to home drive on Windows The restrict_to_home=False case allows any absolute host path (no home jail). On POSIX everything sits under '/'; on Windows the denylist is empty and windows_neutralize_host_root rewrites root_dir '/' at runtime, so a drive-relative '/' must stay allowed. The new _path_within_base containment incorrectly rejected root_dir '/' on Windows when the checkout drive differed from the home drive, breaking from-expert/local_shell agent creation. Also mark test_install_published_expert_accepts_create_options posix_only: it relies on local_shell workspace file writes unsupported on Windows. --------- Co-authored-by: jubaoliang <jubaoliang@tencent.com> Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
"""Tests for email normalize / validate helpers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from octop.infra.errors import ErrorCode, OctopError
|
|
from octop.infra.users.email import normalize_email, parse_optional_email, validate_email_format
|
|
|
|
|
|
def test_normalize_email() -> None:
|
|
assert normalize_email(None) is None
|
|
assert normalize_email("") is None
|
|
assert normalize_email(" ") is None
|
|
assert normalize_email("Alice@Example.COM") == "alice@example.com"
|
|
|
|
|
|
def test_validate_email_format() -> None:
|
|
validate_email_format("a@b.co")
|
|
with pytest.raises(OctopError) as exc:
|
|
validate_email_format("not-an-email")
|
|
assert exc.value.code is ErrorCode.EMAIL_INVALID
|
|
|
|
|
|
def test_parse_optional_email() -> None:
|
|
assert parse_optional_email(None) is None
|
|
assert parse_optional_email(" ") is None
|
|
assert parse_optional_email("Bob@Host.IO") == "bob@host.io"
|
|
with pytest.raises(OctopError) as exc:
|
|
parse_optional_email("bad")
|
|
assert exc.value.code is ErrorCode.EMAIL_INVALID
|