(t *testing.T)
| 29 | } |
| 30 | |
| 31 | func Test_gpgKeyUploadDuplicateKeyBeforeWrongFormat(t *testing.T) { |
| 32 | reg := &httpmock.Registry{} |
| 33 | defer reg.Verify(t) |
| 34 | reg.Register( |
| 35 | httpmock.REST("POST", "user/gpg_keys"), |
| 36 | httpmock.WithHeader(httpmock.StatusStringResponse(http.StatusUnprocessableEntity, `{ |
| 37 | "message": "Validation Failed", |
| 38 | "errors": [{ |
| 39 | "resource": "GpgKey", |
| 40 | "code": "custom", |
| 41 | "field": "key_id", |
| 42 | "message": "key_id already exists" |
| 43 | }] |
| 44 | }`), "Content-Type", "application/json"), |
| 45 | ) |
| 46 | |
| 47 | err := gpgKeyUpload(&http.Client{Transport: reg}, "github.com", strings.NewReader("binary-key"), "") |
| 48 | |
| 49 | require.Same(t, errDuplicateKey, err) |
| 50 | } |
| 51 | |
| 52 | func Test_gpgKeyUploadWrongFormat(t *testing.T) { |
| 53 | reg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected