MCPcopy Index your code
hub / github.com/larksuite/cli / TestWarnPolicyError

Function TestWarnPolicyError

cmd/platform_bootstrap_test.go:255–267  ·  view source on GitHub ↗

warnPolicyError emits to the supplied writer when err is non-nil and stays silent for nil. Verifies the build.go fail-open behaviour can be observed by users.

(t *testing.T)

Source from the content-addressed store, hash-verified

253// stays silent for nil. Verifies the build.go fail-open behaviour can be
254// observed by users.
255func TestWarnPolicyError(t *testing.T) {
256 var buf bytes.Buffer
257 warnPolicyError(&buf, nil)
258 if buf.Len() != 0 {
259 t.Fatalf("warnPolicyError with nil err should write nothing, got %q", buf.String())
260 }
261
262 buf.Reset()
263 warnPolicyError(&buf, errors.New("boom"))
264 if buf.String() != "warning: user policy not applied: boom\n" {
265 t.Fatalf("warnPolicyError output = %q", buf.String())
266 }
267}
268
269// End-to-end through buildInternal: when a valid policy.yml exists in
270// HOME, building the real command tree applies pruning to it. This is

Callers

nothing calls this directly

Calls 2

warnPolicyErrorFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected