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

Function TestParseOutputFormatInvalidValueIsValidationError

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

Source from the content-addressed store, hash-verified

1122}
1123
1124func TestParseOutputFormatInvalidValueIsValidationError(t *testing.T) {
1125 _, err := parseOutputFormat("yaml")
1126 if err == nil {
1127 t.Fatal("expected invalid output format error")
1128 }
1129 if got := jsonErrorCode(err); got != jsonErrorCodeInvalidArguments {
1130 t.Fatalf("jsonErrorCode = %q, want %q", got, jsonErrorCodeInvalidArguments)
1131 }
1132 if got := exitCodeForError(err); got != exitCodeValidationError {
1133 t.Fatalf("exitCodeForError = %d, want %d", got, exitCodeValidationError)
1134 }
1135
1136 details := jsonErrorDetails(err)
1137 if details["flag"] != outputFlag {
1138 t.Fatalf("details[flag] = %v, want %q", details["flag"], outputFlag)
1139 }
1140 if details["value"] != "yaml" {
1141 t.Fatalf("details[value] = %v, want yaml", details["value"])
1142 }
1143}
1144
1145func TestJSONErrorCodeClassifiesDropboxAPIErrors(t *testing.T) {
1146 expiredAuth := dropboxauth.AuthAPIError{AuthError: &dropboxauth.AuthError{}}

Callers

nothing calls this directly

Calls 4

parseOutputFormatFunction · 0.85
jsonErrorCodeFunction · 0.85
exitCodeForErrorFunction · 0.85
jsonErrorDetailsFunction · 0.85

Tested by

no test coverage detected