on main help sign in
test: verify tools are taken from agent when disabled (#1103)
56d6486Adam Stringer
internal/config/load_test.go+23
@@ -492,6 +492,29 @@ func TestConfig_setupAgentsWithDisabledTools(t *testing.T) {
492 assert.Equal(t, []string{"glob", "ls", "sourcegraph", "view"}, taskAgent.AllowedTools)
492 assert.Equal(t, []string{"glob", "ls", "sourcegraph", "view"}, taskAgent.AllowedTools)
493}
493}
494
494
495+func TestConfig_setupAgentsWithEveryReadOnlyToolDisabled(t *testing.T) {
496+ cfg := &Config{
497+ Options: &Options{
498+ DisabledTools: []string{
499+ "glob",
500+ "grep",
501+ "ls",
502+ "sourcegraph",
503+ "view",
504+ },
505+ },
506+ }
507+
508+ cfg.SetupAgents()
509+ coderAgent, ok := cfg.Agents["coder"]
510+ require.True(t, ok)
511+ assert.Equal(t, []string{"bash", "download", "edit", "multiedit", "fetch", "write"}, coderAgent.AllowedTools)
512+
513+ taskAgent, ok := cfg.Agents["task"]
514+ require.True(t, ok)
515+ assert.Equal(t, []string{}, taskAgent.AllowedTools)
516+}
517+
495func TestConfig_configureProvidersWithDisabledProvider(t *testing.T) {
518func TestConfig_configureProvidersWithDisabledProvider(t *testing.T) {
496 knownProviders := []catwalk.Provider{
519 knownProviders := []catwalk.Provider{
497 {
520 {