(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func TestScanForSafety_ScanError_FailOpen(t *testing.T) { |
| 106 | t.Setenv("LARKSUITE_CLI_CONTENT_SAFETY_MODE", "block") |
| 107 | mp := &mockProvider{name: "mock", err: errors.New("scan broke")} |
| 108 | extcs.Register(mp) |
| 109 | defer extcs.Register(nil) |
| 110 | |
| 111 | var buf bytes.Buffer |
| 112 | result := ScanForSafety("lark-cli im +test", map[string]any{}, &buf) |
| 113 | if result.Blocked { |
| 114 | t.Error("scan error should fail-open, not block") |
| 115 | } |
| 116 | if !strings.Contains(buf.String(), "scan error") { |
| 117 | t.Errorf("expected warning on stderr, got: %s", buf.String()) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | func TestScanForSafety_SlowProvider_Timeout_FailOpen(t *testing.T) { |
| 122 | t.Setenv("LARKSUITE_CLI_CONTENT_SAFETY_MODE", "block") |
nothing calls this directly
no test coverage detected