Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions loopx/extensions/lark/app_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

_OFFICIAL_SETUP_HOSTS = (
"open.feishu.cn",
"open.larksuite.com",
"open." + "la" + "rk" + "office.com",
)
OFFICIAL_SETUP_URL_PATTERN = re.compile(
Expand Down
3 changes: 2 additions & 1 deletion tests/control_plane_ts/host_stdio_bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {tmpdir} from "node:os";
import {join} from "node:path";
import {setTimeout as delay} from "node:timers/promises";
import test from "node:test";
import {fileURLToPath} from "node:url";

const bridge = new URL("../../loopx/control_plane/turn_driver/host_stdio_bridge.ts", import.meta.url).pathname;
const bridge = fileURLToPath(new URL("../../loopx/control_plane/turn_driver/host_stdio_bridge.ts", import.meta.url));
const launch = (script: string) => spawn(process.execPath,
["--no-warnings", "--experimental-strip-types", bridge, process.execPath, "-e", script],
{stdio: ["pipe", "pipe", "pipe"]});
Expand Down
28 changes: 28 additions & 0 deletions tests/extensions/test_lark_app_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,34 @@ def test_setup_accepts_the_official_lark_authorization_host() -> None:
)


def test_setup_accepts_the_international_lark_authorization_host() -> None:
verification_url = (
"https://open.larksuite.com/page/cli?user_code=public-code"
"&lpv=1.0.99&ocv=1.0.99&from=cli"
)
manager = LarkAppSetupManager(
cli_resolution=LarkCliResolution(
command="fake-lark",
available=True,
source="path",
version="1.0.99",
error_code=None,
),
process_factory=lambda _args, _env: _FakeProcess([
"打开以下链接配置应用:\n",
f" {verification_url}\n",
"等待配置应用...\n",
]),
profile_verifier=lambda app_ref: app_ref == "loopx-lark-bot",
)

started = manager.start(app_ref="loopx-lark-bot", brand="lark")
completed = _wait_for_terminal(manager, started["setup_id"])

assert completed["status"] == "ready"
assert completed["verification_url"] == verification_url


def test_cancel_stops_the_registration_process_without_exposing_logs() -> None:
process = _BlockingProcess()
manager = LarkAppSetupManager(
Expand Down
Loading