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

Function TestUploadHostForTenant

internal/attachments/client_test.go:94–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestUploadHostForTenant(t *testing.T) {
95 a := testAsset(t, "shot.png", "image/png", "x")
96
97 reg := &httpmock.Registry{}
98 defer reg.Verify(t)
99 reg.Register(
100 httpmock.REST("POST", "user-attachments/assets"),
101 httpmock.StatusStringResponse(201, `{"url":"https://acme.ghe.com/user-attachments/assets/1"}`),
102 )
103
104 _, err := newTestUploader(t, reg, "acme.ghe.com", 1).upload(context.Background(), a)
105
106 require.NoError(t, err)
107 require.Len(t, reg.Requests, 1)
108 assert.Equal(t, "uploads.acme.ghe.com", reg.Requests[0].URL.Host)
109}
110
111func TestUploadAuthentication(t *testing.T) {
112 tests := []struct {

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
RESTFunction · 0.92
StatusStringResponseFunction · 0.92
testAssetFunction · 0.85
newTestUploaderFunction · 0.85
uploadMethod · 0.80
EqualMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected