(t *testing.T)
| 1122 | } |
| 1123 | |
| 1124 | func 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 | |
| 1145 | func TestJSONErrorCodeClassifiesDropboxAPIErrors(t *testing.T) { |
| 1146 | expiredAuth := dropboxauth.AuthAPIError{AuthError: &dropboxauth.AuthError{}} |
nothing calls this directly
no test coverage detected