MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestJSONErrorDetailsIncludesAuthRemediation

Function TestJSONErrorDetailsIncludesAuthRemediation

cmd/output_test.go:656–671  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

654}
655
656func TestJSONErrorDetailsIncludesAuthRemediation(t *testing.T) {
657 got := newJSONErrorResponse(&cobra.Command{Use: "account"}, missingAccessTokenError(tokenPersonal))
658
659 if got.Error.Code != jsonErrorCodeAuthRequired {
660 t.Fatalf("code = %q, want %q", got.Error.Code, jsonErrorCodeAuthRequired)
661 }
662 for key, want := range map[string]any{
663 "token_type": tokenPersonal,
664 "login_command": "dbxcli login",
665 "env_var": envAccessToken,
666 } {
667 if got.Error.Details[key] != want {
668 t.Fatalf("details = %+v, want %s=%v", got.Error.Details, key, want)
669 }
670 }
671}
672
673func TestRenderCommandErrorWritesUnsupportedStructuredOutputAsJSON(t *testing.T) {
674 var stdout bytes.Buffer

Callers

nothing calls this directly

Calls 2

newJSONErrorResponseFunction · 0.85
missingAccessTokenErrorFunction · 0.85

Tested by

no test coverage detected