MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestExtractAccessToken

Function TestExtractAccessToken

sdk/auth/filestore_test.go:13–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestExtractAccessToken(t *testing.T) {
14 t.Parallel()
15
16 tests := []struct {
17 name string
18 metadata map[string]any
19 expected string
20 }{
21 {
22 "antigravity top-level access_token",
23 map[string]any{"access_token": "tok-abc"},
24 "tok-abc",
25 },
26 {
27 "gemini nested token.access_token",
28 map[string]any{
29 "token": map[string]any{"access_token": "tok-nested"},
30 },
31 "tok-nested",
32 },
33 {
34 "top-level takes precedence over nested",
35 map[string]any{
36 "access_token": "tok-top",
37 "token": map[string]any{"access_token": "tok-nested"},
38 },
39 "tok-top",
40 },
41 {
42 "empty metadata",
43 map[string]any{},
44 "",
45 },
46 {
47 "whitespace-only access_token",
48 map[string]any{"access_token": " "},
49 "",
50 },
51 {
52 "wrong type access_token",
53 map[string]any{"access_token": 12345},
54 "",
55 },
56 {
57 "token is not a map",
58 map[string]any{"token": "not-a-map"},
59 "",
60 },
61 {
62 "nested whitespace-only",
63 map[string]any{
64 "token": map[string]any{"access_token": " "},
65 },
66 "",
67 },
68 {
69 "fallback to nested when top-level empty",
70 map[string]any{

Callers

nothing calls this directly

Calls 2

extractAccessTokenFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected