MCPcopy Create free account
hub / github.com/cli/cli / Test_gpgKeyUploadWrongFormat

Function Test_gpgKeyUploadWrongFormat

pkg/cmd/gpg-key/add/add_test.go:52–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func 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
72func Test_gpgKeyUploadHTTPError(t *testing.T) {
73 reg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 5

VerifyMethod · 0.95
RegisterMethod · 0.95
RESTFunction · 0.92
StatusStringResponseFunction · 0.92
gpgKeyUploadFunction · 0.85

Tested by

no test coverage detected