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

Function TestRepositoriesService_GetVulnerabilityAlerts

github/repos_test.go:582–616  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

580}
581
582func TestRepositoriesService_GetVulnerabilityAlerts(t *testing.T) {
583 t.Parallel()
584 client, mux, _ := setup(t)
585
586 mux.HandleFunc("/repos/o/r/vulnerability-alerts", func(w http.ResponseWriter, r *http.Request) {
587 testMethod(t, r, "GET")
588 testHeader(t, r, "Accept", mediaTypeRequiredVulnerabilityAlertsPreview)
589
590 w.WriteHeader(http.StatusNoContent)
591 })
592
593 ctx := t.Context()
594 vulnerabilityAlertsEnabled, _, err := client.Repositories.GetVulnerabilityAlerts(ctx, "o", "r")
595 if err != nil {
596 t.Errorf("Repositories.GetVulnerabilityAlerts returned error: %v", err)
597 }
598
599 if want := true; vulnerabilityAlertsEnabled != want {
600 t.Errorf("Repositories.GetVulnerabilityAlerts returned %+v, want %+v", vulnerabilityAlertsEnabled, want)
601 }
602
603 const methodName = "GetVulnerabilityAlerts"
604 testBadOptions(t, methodName, func() (err error) {
605 _, _, err = client.Repositories.GetVulnerabilityAlerts(ctx, "\n", "\n")
606 return err
607 })
608
609 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
610 got, resp, err := client.Repositories.GetVulnerabilityAlerts(ctx, "o", "r")
611 if got {
612 t.Errorf("testNewRequestAndDoFailure %v = %#v, want false", methodName, got)
613 }
614 return resp, err
615 })
616}
617
618func TestRepositoriesService_EnableVulnerabilityAlerts(t *testing.T) {
619 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
testHeaderFunction · 0.85
testBadOptionsFunction · 0.85
setupFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…