跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

device_test.go

31 行 · 876 B历史下载
1package mobilelink
2
3import (
4 "net/url"
5 "testing"
6)
7
8func TestDeviceModel(t *testing.T) {
9 for _, tc := range []struct{ platform, raw, want string }{
10 {"ios", "iPhone17,1", "iPhone 16 Pro"},
11 {"ios", "iPhone18,1", "iPhone 17 Pro"},
12 {"ios", "iPhone99,1", "iPhone (iPhone99,1)"},
13 {"ios", "iPad99,1", "iPad (iPad99,1)"},
14 {"android", " Google Pixel 9 Pro ", "Google Pixel 9 Pro"},
15 } {
16 if got := DeviceModel(tc.platform, tc.raw); got != tc.want {
17 t.Errorf("%s %q: got %q, want %q", tc.platform, tc.raw, got, tc.want)
18 }
19 }
20}
21
22func TestDeviceReportOperationBoundary(t *testing.T) {
23 u := &url.URL{Path: "/api/mobile/device"}
24 if !allowed("POST", u) || allowed("GET", u) || allowed("DELETE", u) {
25 t.Fatal("device report must only accept POST")
26 }
27 u.RawQuery = "model=other"
28 if allowed("POST", u) {
29 t.Fatal("device report must not accept query parameters")
30 }
31}