MCPcopy Create free account
hub / github.com/astercloud/aster / TestIsToolSafeForAutoApproval

Function TestIsToolSafeForAutoApproval

pkg/tools/annotations_test.go:237–251  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

235}
236
237func TestIsToolSafeForAutoApproval(t *testing.T) {
238 safeTool := &mockToolWithAnnotations{name: "safe", annotations: AnnotationsSafeReadOnly}
239 unsafeTool := &mockToolWithAnnotations{name: "unsafe", annotations: AnnotationsDestructiveWrite}
240 noAnnotationTool := &mockToolWithoutAnnotations{name: "none"}
241
242 if !IsToolSafeForAutoApproval(safeTool) {
243 t.Error("Safe read-only tool should be safe for auto approval")
244 }
245 if IsToolSafeForAutoApproval(unsafeTool) {
246 t.Error("Destructive tool should not be safe for auto approval")
247 }
248 if IsToolSafeForAutoApproval(noAnnotationTool) {
249 t.Error("Tool without annotations should not be safe for auto approval by default")
250 }
251}
252
253func TestGetToolRiskLevel(t *testing.T) {
254 highRiskTool := &mockToolWithAnnotations{name: "high", annotations: AnnotationsDestructiveWrite}

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.65

Tested by

no test coverage detected