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

Function TestToolAnnotations_IsSafeForAutoApproval

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

Source from the content-addressed store, hash-verified

56}
57
58func TestToolAnnotations_IsSafeForAutoApproval(t *testing.T) {
59 tests := []struct {
60 name string
61 ann *ToolAnnotations
62 expected bool
63 }{
64 {
65 name: "safe read-only",
66 ann: AnnotationsSafeReadOnly,
67 expected: true,
68 },
69 {
70 name: "safe write",
71 ann: AnnotationsSafeWrite,
72 expected: false,
73 },
74 {
75 name: "destructive write",
76 ann: AnnotationsDestructiveWrite,
77 expected: false,
78 },
79 {
80 name: "execution",
81 ann: AnnotationsExecution,
82 expected: false,
83 },
84 {
85 name: "network read",
86 ann: AnnotationsNetworkRead,
87 expected: false, // OpenWorld = true
88 },
89 {
90 name: "read-only but open world",
91 ann: &ToolAnnotations{ReadOnly: true, OpenWorld: true},
92 expected: false,
93 },
94 {
95 name: "read-only internal",
96 ann: &ToolAnnotations{ReadOnly: true, OpenWorld: false},
97 expected: true,
98 },
99 }
100
101 for _, tt := range tests {
102 t.Run(tt.name, func(t *testing.T) {
103 if got := tt.ann.IsSafeForAutoApproval(); got != tt.expected {
104 t.Errorf("IsSafeForAutoApproval() = %v, want %v", got, tt.expected)
105 }
106 })
107 }
108}
109
110func TestToolAnnotations_RiskLevelName(t *testing.T) {
111 tests := []struct {

Callers

nothing calls this directly

Calls 2

IsSafeForAutoApprovalMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected