(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func Test_gpgKeyUploadWrongFormat(t *testing.T) { |
| 53 | reg := &httpmock.Registry{} |
| 54 | defer reg.Verify(t) |
| 55 | reg.Register( |
| 56 | httpmock.REST("POST", "user/gpg_keys"), |
| 57 | httpmock.StatusStringResponse(http.StatusUnprocessableEntity, `{ |
| 58 | "message": "Validation Failed", |
| 59 | "errors": [{ |
| 60 | "resource": "GpgKey", |
| 61 | "code": "custom", |
| 62 | "message": "We got an error doing that." |
| 63 | }] |
| 64 | }`), |
| 65 | ) |
| 66 | |
| 67 | err := gpgKeyUpload(&http.Client{Transport: reg}, "github.com", strings.NewReader("binary-key"), "") |
| 68 | |
| 69 | require.Same(t, errWrongFormat, err) |
| 70 | } |
| 71 | |
| 72 | func Test_gpgKeyUploadHTTPError(t *testing.T) { |
| 73 | reg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected