Download this file
| 1 | package claude |
| 2 | |
| 3 | import ( |
| 4 | "encoding/json" |
| 5 | "testing" |
| 6 | |
| 7 | "amadan.net/oficina/equipo/internal/runner/provider" |
| 8 | ) |
| 9 | |
| 10 | func TestClaudeAuthManifestVersion(t *testing.T) { |
| 11 | for _, version := range []string{Version, "other", ""} { |
| 12 | t.Run(version, func(t *testing.T) { |
| 13 | manifest := map[string]any{"Argv": AuthStatusArgs()} |
| 14 | if version != "" { |
| 15 | manifest["ProviderVersion"] = version |
| 16 | } |
| 17 | raw, _ := json.Marshal(manifest) |
| 18 | l := provider.Launch{Selection: provider.Selection{Provider: "claude"}, Binding: provider.Binding{Expected: provider.Identity{ProviderVersion: Version}}, Policy: provider.Policy{Manifest: raw, ManifestHash: provider.ManifestDigest(raw)}} |
| 19 | if AuthStatusDocument(l) != (version == Version) { |
| 20 | t.Fatal("manifest version was not checked") |
| 21 | } |
| 22 | }) |
| 23 | } |
| 24 | args := AuthStatusArgs() |
| 25 | args[0] = "mutated" |
| 26 | if AuthStatusArgs()[0] != "/opt/claude" { |
| 27 | t.Fatal("auth command is mutable") |
| 28 | } |
| 29 | } |
| 30 | |