(t *testing.T)
| 185 | } |
| 186 | |
| 187 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…