MCPcopy Index your code
hub / github.com/google/go-github / TestRepositoriesService_Subscribe

Function TestRepositoriesService_Subscribe

github/repos_hooks_test.go:560–591  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

558}
559
560func TestRepositoriesService_Subscribe(t *testing.T) {
561 t.Parallel()
562 client, mux, _ := setup(t)
563
564 mux.HandleFunc("/hub", func(_ http.ResponseWriter, r *http.Request) {
565 testMethod(t, r, "POST")
566 testHeader(t, r, "Content-Type", "application/x-www-form-urlencoded")
567 testFormValues(t, r, values{
568 "hub.mode": "subscribe",
569 "hub.topic": "https://github.com/o/r/events/push",
570 "hub.callback": "http://localhost:8080/callback",
571 "hub.secret": "test secret",
572 })
573 })
574
575 ctx := t.Context()
576 _, err := client.Repositories.Subscribe(
577 ctx,
578 "o",
579 "r",
580 "push",
581 "http://localhost:8080/callback",
582 []byte("test secret"),
583 )
584 if err != nil {
585 t.Errorf("Repositories.Subscribe returned error: %v", err)
586 }
587
588 testNewRequestAndDoFailure(t, "Subscribe", client, func() (*Response, error) {
589 return client.Repositories.Subscribe(ctx, "o", "r", "push", "http://localhost:8080", nil)
590 })
591}
592
593func TestRepositoriesService_Unsubscribe(t *testing.T) {
594 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
testHeaderFunction · 0.85
testFormValuesFunction · 0.85
SubscribeMethod · 0.80
setupFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…