Skip to content

Commit 7b5abf2

Browse files
fix(hooks): remove unused push hook (#79)
1 parent 7fe4ea4 commit 7b5abf2

3 files changed

Lines changed: 0 additions & 75 deletions

File tree

api/push.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

hooks/hooks.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,27 +99,3 @@ func CreateBuild(c *deis.Client, username, app, image, gitSha string, procfile a
9999

100100
return resMap["release"]["version"], reqErr
101101
}
102-
103-
// CreatePush creates a new push for an application.
104-
// gitSha should be the first 8 charecters of the git commit sha.
105-
func CreatePush(c *deis.Client, username, app, gitSha, fingerprint, conn, cmd string) error {
106-
req := api.PushRequest{
107-
Sha: gitSha,
108-
User: username,
109-
App: app,
110-
Fingerprint: fingerprint,
111-
Connection: conn,
112-
Command: cmd,
113-
}
114-
115-
b, err := json.Marshal(req)
116-
if err != nil {
117-
return err
118-
}
119-
120-
res, reqErr := c.Request("POST", "/v2/hooks/push/", b)
121-
if reqErr == nil {
122-
res.Body.Close()
123-
}
124-
return reqErr
125-
}

hooks/hooks_test.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,6 @@ func (fakeHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request) {
111111
return
112112
}
113113

114-
if req.URL.Path == "/v2/hooks/push/" && req.Method == "POST" {
115-
body, err := ioutil.ReadAll(req.Body)
116-
117-
if err != nil {
118-
fmt.Println(err)
119-
res.WriteHeader(http.StatusInternalServerError)
120-
res.Write(nil)
121-
}
122-
123-
if string(body) != pushHookExpected {
124-
fmt.Printf("Expected '%s', Got '%s'\n", pushHookExpected, body)
125-
res.WriteHeader(http.StatusInternalServerError)
126-
res.Write(nil)
127-
return
128-
}
129-
130-
res.WriteHeader(http.StatusCreated)
131-
res.Write([]byte(nil))
132-
return
133-
}
134-
135114
fmt.Printf("Unrecongized URL %s\n", req.URL)
136115
res.WriteHeader(http.StatusNotFound)
137116
res.Write(nil)
@@ -236,22 +215,3 @@ func TestBuildHook(t *testing.T) {
236215
t.Errorf("Expected %v, Got %v", expected, actual)
237216
}
238217
}
239-
240-
func TestPushHook(t *testing.T) {
241-
t.Parallel()
242-
243-
handler := fakeHTTPServer{}
244-
server := httptest.NewServer(&handler)
245-
defer server.Close()
246-
247-
deis, err := deis.New(false, server.URL, "abc")
248-
if err != nil {
249-
t.Fatal(err)
250-
}
251-
252-
err = CreatePush(deis, "test", "example-go", "abc123", "testing", "1234", "foo")
253-
254-
if err != nil {
255-
t.Error(err)
256-
}
257-
}

0 commit comments

Comments
 (0)