Skip to content

Commit cf38b2b

Browse files
joshuabezaleelgmlewis
authored andcommitted
Removing testhook, edithook, and pinghook from the code and the test file (#1111)
Fixes #1109.
1 parent b11636a commit cf38b2b

File tree

2 files changed

+0
-115
lines changed

2 files changed

+0
-115
lines changed

github/repos_hooks.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,6 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i
169169
return h, resp, nil
170170
}
171171

172-
// EditHook updates a specified Hook.
173-
//
174-
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#edit-a-hook
175-
func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) {
176-
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
177-
req, err := s.client.NewRequest("PATCH", u, hook)
178-
if err != nil {
179-
return nil, nil, err
180-
}
181-
h := new(Hook)
182-
resp, err := s.client.Do(ctx, req, h)
183-
if err != nil {
184-
return nil, resp, err
185-
}
186-
187-
return h, resp, nil
188-
}
189-
190172
// DeleteHook deletes a specified Hook.
191173
//
192174
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#delete-a-hook
@@ -198,27 +180,3 @@ func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string
198180
}
199181
return s.client.Do(ctx, req, nil)
200182
}
201-
202-
// PingHook triggers a 'ping' event to be sent to the Hook.
203-
//
204-
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#ping-a-hook
205-
func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
206-
u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id)
207-
req, err := s.client.NewRequest("POST", u, nil)
208-
if err != nil {
209-
return nil, err
210-
}
211-
return s.client.Do(ctx, req, nil)
212-
}
213-
214-
// TestHook triggers a test Hook by github.
215-
//
216-
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#test-a-push-hook
217-
func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
218-
u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id)
219-
req, err := s.client.NewRequest("POST", u, nil)
220-
if err != nil {
221-
return nil, err
222-
}
223-
return s.client.Do(ctx, req, nil)
224-
}

github/repos_hooks_test.go

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -103,43 +103,6 @@ func TestRepositoriesService_GetHook_invalidOwner(t *testing.T) {
103103
testURLParseError(t, err)
104104
}
105105

106-
func TestRepositoriesService_EditHook(t *testing.T) {
107-
client, mux, _, teardown := setup()
108-
defer teardown()
109-
110-
input := &Hook{}
111-
112-
mux.HandleFunc("/repos/o/r/hooks/1", func(w http.ResponseWriter, r *http.Request) {
113-
v := new(Hook)
114-
json.NewDecoder(r.Body).Decode(v)
115-
116-
testMethod(t, r, "PATCH")
117-
if !reflect.DeepEqual(v, input) {
118-
t.Errorf("Request body = %+v, want %+v", v, input)
119-
}
120-
121-
fmt.Fprint(w, `{"id":1}`)
122-
})
123-
124-
hook, _, err := client.Repositories.EditHook(context.Background(), "o", "r", 1, input)
125-
if err != nil {
126-
t.Errorf("Repositories.EditHook returned error: %v", err)
127-
}
128-
129-
want := &Hook{ID: Int64(1)}
130-
if !reflect.DeepEqual(hook, want) {
131-
t.Errorf("Repositories.EditHook returned %+v, want %+v", hook, want)
132-
}
133-
}
134-
135-
func TestRepositoriesService_EditHook_invalidOwner(t *testing.T) {
136-
client, _, _, teardown := setup()
137-
defer teardown()
138-
139-
_, _, err := client.Repositories.EditHook(context.Background(), "%", "%", 1, nil)
140-
testURLParseError(t, err)
141-
}
142-
143106
func TestRepositoriesService_DeleteHook(t *testing.T) {
144107
client, mux, _, teardown := setup()
145108
defer teardown()
@@ -161,39 +124,3 @@ func TestRepositoriesService_DeleteHook_invalidOwner(t *testing.T) {
161124
_, err := client.Repositories.DeleteHook(context.Background(), "%", "%", 1)
162125
testURLParseError(t, err)
163126
}
164-
165-
func TestRepositoriesService_PingHook(t *testing.T) {
166-
client, mux, _, teardown := setup()
167-
defer teardown()
168-
169-
mux.HandleFunc("/repos/o/r/hooks/1/pings", func(w http.ResponseWriter, r *http.Request) {
170-
testMethod(t, r, "POST")
171-
})
172-
173-
_, err := client.Repositories.PingHook(context.Background(), "o", "r", 1)
174-
if err != nil {
175-
t.Errorf("Repositories.PingHook returned error: %v", err)
176-
}
177-
}
178-
179-
func TestRepositoriesService_TestHook(t *testing.T) {
180-
client, mux, _, teardown := setup()
181-
defer teardown()
182-
183-
mux.HandleFunc("/repos/o/r/hooks/1/tests", func(w http.ResponseWriter, r *http.Request) {
184-
testMethod(t, r, "POST")
185-
})
186-
187-
_, err := client.Repositories.TestHook(context.Background(), "o", "r", 1)
188-
if err != nil {
189-
t.Errorf("Repositories.TestHook returned error: %v", err)
190-
}
191-
}
192-
193-
func TestRepositoriesService_TestHook_invalidOwner(t *testing.T) {
194-
client, _, _, teardown := setup()
195-
defer teardown()
196-
197-
_, err := client.Repositories.TestHook(context.Background(), "%", "%", 1)
198-
testURLParseError(t, err)
199-
}

0 commit comments

Comments
 (0)