跳到主要内容

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

浏览文件

applied_test.go

32 行 · 1.0 KB历史下载
1package managedproxy
2
3import "testing"
4
5func TestEndpointAloneCannotAuthorizeNetworking(t *testing.T) {
6 profile := t.TempDir()
7 p, _ := Load(profile)
8 if _, err := Applied(profile, "socks5://127.0.0.1:17896", ""); err == nil {
9 t.Fatal("old endpoint accepted without nodes")
10 }
11 if err := p.Import("qa", "", []byte(`proxies: [{name: qa, type: socks5, server: 127.0.0.1, port: 1080}]`), "qa", 0, ""); err != nil {
12 t.Fatal(err)
13 }
14 p.Revision = "applied"
15 p.Selected = p.Sources[0].Nodes[0].ID
16 if err := p.Save(profile); err != nil {
17 t.Fatal(err)
18 }
19 for _, input := range [][2]string{{p.Endpoint(), ""}, {p.Endpoint(), "old"}, {"socks5://127.0.0.1:7890", p.Revision}} {
20 if _, err := Applied(profile, input[0], input[1]); err == nil {
21 t.Fatal("unapplied endpoint accepted")
22 }
23 }
24 if _, err := Applied(profile, p.Endpoint(), p.Revision); err != nil {
25 t.Fatal(err)
26 }
27 p.Selected = ""
28 _ = p.Save(profile)
29 if _, err := Applied(profile, p.Endpoint(), p.Revision); err == nil {
30 t.Fatal("removed node retained networking authorization")
31 }
32}