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