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

Function TestCreateRunResourceHost

pkg/cmd/event/subscription/create/create_test.go:191–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

189}
190
191func TestCreateRunResourceHost(t *testing.T) {
192 ios, _, _, _ := iostreams.Test()
193 var gotHost string
194 opts := &CreateOptions{
195 IO: ios,
196 Config: func() (gh.Config, error) { return config.NewMockConfig(), nil },
197 EventClient: func(host string) (client.EventClient, error) {
198 gotHost = host
199 return &client.EventClientMock{
200 CreateSubscriptionFunc: func(context.Context, string, []string) (*client.Subscription, bool, error) {
201 return &client.Subscription{ID: "sub_1"}, true, nil
202 },
203 }, nil
204 },
205 Now: time.Now,
206 Resource: "https://ghe.example.com/OWNER/REPO/pull/1",
207 Events: []string{"test.a"},
208 }
209
210 require.NoError(t, createRun(context.Background(), opts))
211 assert.Equal(t, "ghe.example.com", gotHost)
212}

Callers

nothing calls this directly

Calls 4

TestFunction · 0.92
NewMockConfigFunction · 0.92
EqualMethod · 0.80
createRunFunction · 0.70

Tested by

no test coverage detected