TestApplyDefaultTools tests default tool application logic
(t *testing.T)
| 452 | |
| 453 | // TestApplyDefaultTools tests default tool application logic |
| 454 | func TestApplyDefaultTools(t *testing.T) { |
| 455 | tests := []struct { |
| 456 | name string |
| 457 | tools map[string]any |
| 458 | safeOutputs *SafeOutputsConfig |
| 459 | sandboxConfig *SandboxConfig |
| 460 | networkPermissions *NetworkPermissions |
| 461 | expectedGitHub bool // true if github tool should exist |
| 462 | expectedEdit bool |
| 463 | expectedBash bool |
| 464 | checkBashWildcard bool |
| 465 | checkGitCommands bool |
| 466 | checkBashDefault bool |
| 467 | expectedBashCommands []string |
| 468 | }{ |
| 469 | { |
| 470 | name: "nil tools creates github tool", |
| 471 | tools: nil, |
| 472 | expectedGitHub: true, |
| 473 | expectedEdit: false, |
| 474 | expectedBash: false, |
| 475 | }, |
| 476 | { |
| 477 | name: "empty tools adds github tool", |
| 478 | tools: map[string]any{}, |
| 479 | expectedGitHub: true, |
| 480 | expectedEdit: false, |
| 481 | expectedBash: false, |
| 482 | }, |
| 483 | { |
| 484 | name: "github explicitly disabled", |
| 485 | tools: map[string]any{ |
| 486 | "github": false, |
| 487 | }, |
| 488 | expectedGitHub: false, |
| 489 | expectedEdit: false, |
| 490 | expectedBash: false, |
| 491 | }, |
| 492 | { |
| 493 | name: "sandbox enabled adds edit and bash", |
| 494 | tools: map[string]any{}, |
| 495 | sandboxConfig: &SandboxConfig{ |
| 496 | Agent: &AgentSandboxConfig{ |
| 497 | ID: "awf", |
| 498 | }, |
| 499 | }, |
| 500 | expectedGitHub: true, |
| 501 | expectedEdit: true, |
| 502 | expectedBash: true, |
| 503 | checkBashWildcard: false, // Sandbox adds bash but may also include default commands |
| 504 | }, |
| 505 | { |
| 506 | name: "firewall enabled adds edit and bash", |
| 507 | tools: map[string]any{}, |
| 508 | networkPermissions: &NetworkPermissions{ |
| 509 | Firewall: &FirewallConfig{ |
| 510 | Enabled: true, |
| 511 | }, |
nothing calls this directly
no test coverage detected