From e4525fb4aacb0653a7c3129a7f81259811ca10ce Mon Sep 17 00:00:00 2001 From: Denys Zhuravel Date: Mon, 5 Sep 2022 15:18:39 +0000 Subject: [PATCH] Add dummy routes to the test stub to mimic the github api --- test/github.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/github.go b/test/github.go index 39bd814..f767798 100644 --- a/test/github.go +++ b/test/github.go @@ -26,6 +26,10 @@ func main() { r := mux.NewRouter() r.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) {}) + r.HandleFunc("/api/v3", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("x-github-enterprise-version", "GitHub AE") + }) + r.HandleFunc("/api/v3/user", func(w http.ResponseWriter, r *http.Request) { currentUser := github.User{Login: &authenticatedLogin} b, _ := json.Marshal(currentUser) @@ -35,6 +39,17 @@ func main() { } }) + r.HandleFunc("/api/v3/admin/users/actions-admin/authorizations", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("x-github-enterprise-version", "GitHub AE") + token := "token" + auth := github.Authorization{Token: &token} + b, _ := json.Marshal(auth) + _, err := w.Write(b) + if err != nil { + panic(err) + } + }).Methods("POST") + r.HandleFunc("/api/v3/admin/organizations", func(w http.ResponseWriter, r *http.Request) { b, err := ioutil.ReadAll(r.Body) if err != nil {