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

Function TestUploadHostForTenant

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

Source from the content-addressed store, hash-verified

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