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

Function TestActivity_Watching

test/integration/activity_test.go:109–135  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func TestActivity_Watching(t *testing.T) {
110 watchers, _, err := client.Activity.ListWatchers(t.Context(), owner, repo, nil)
111 if err != nil {
112 t.Fatalf("Activity.ListWatchers returned error: %v", err)
113 }
114
115 if len(watchers) == 0 {
116 t.Errorf("Activity.ListWatchers(%q, %q) returned no watchers", owner, repo)
117 }
118
119 // the rest of the tests requires auth
120 skipIfMissingAuth(t)
121
122 // first, check if already watching the target repository
123 sub, _, err := client.Activity.GetRepositorySubscription(t.Context(), owner, repo)
124 if err != nil {
125 t.Fatalf("Activity.GetRepositorySubscription returned error: %v", err)
126 }
127
128 if sub != nil { // If already subscribing, delete then recreate subscription.
129 deleteSubscription(t)
130 createSubscription(t)
131 } else { // Otherwise, create subscription and then delete it.
132 createSubscription(t)
133 deleteSubscription(t)
134 }
135}

Callers

nothing calls this directly

Calls 5

skipIfMissingAuthFunction · 0.85
deleteSubscriptionFunction · 0.85
createSubscriptionFunction · 0.85
ListWatchersMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…