MCPcopy Create free account
hub / github.com/google/go-github / TestRepositories_Autolinks

Function TestRepositories_Autolinks

test/integration/repos_test.go:187–213  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

185}
186
187func TestRepositories_Autolinks(t *testing.T) {
188 skipIfMissingAuth(t)
189
190 repo := createRandomTestRepository(t, "", true)
191
192 opts := &github.AutolinkOptions{
193 KeyPrefix: github.Ptr("TICKET-"),
194 URLTemplate: github.Ptr("https://example.com/TICKET?query=<num>"),
195 IsAlphanumeric: github.Ptr(false),
196 }
197
198 actionlink, _, err := client.Repositories.AddAutolink(t.Context(), *repo.Owner.Login, *repo.Name, opts)
199 if err != nil {
200 t.Fatalf("Repositories.AddAutolink() returned error: %v", err)
201 }
202
203 if !cmp.Equal(actionlink.KeyPrefix, opts.KeyPrefix) ||
204 !cmp.Equal(actionlink.URLTemplate, opts.URLTemplate) ||
205 !cmp.Equal(actionlink.IsAlphanumeric, opts.IsAlphanumeric) {
206 t.Errorf("Repositories.AddAutolink() returned %+v, want %+v", actionlink, opts)
207 }
208
209 _, err = client.Repositories.Delete(t.Context(), *repo.Owner.Login, *repo.Name)
210 if err != nil {
211 t.Fatalf("Repositories.Delete() returned error: %v", err)
212 }
213}

Callers

nothing calls this directly

Calls 6

PtrFunction · 0.92
skipIfMissingAuthFunction · 0.85
AddAutolinkMethod · 0.80
EqualMethod · 0.80
DeleteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…