summaryrefslogtreecommitdiff
path: root/go/internal/command/receivepack/receivepack_test.go
diff options
context:
space:
mode:
authorIgor <idrozdov@gitlab.com>2019-06-03 15:21:25 +0000
committerNick Thomas <nick@gitlab.com>2019-06-03 15:21:25 +0000
commitcde5b73cb8776c70c6d00ff34c568ea4438bcba9 (patch)
treeddc0d81da81ebfdb2c05819c88cde2c56dbaf4d5 /go/internal/command/receivepack/receivepack_test.go
parentbeb5855542645cdc9bf7f954b9c5a9333dfb3975 (diff)
downloadgitlab-shell-cde5b73cb8776c70c6d00ff34c568ea4438bcba9.tar.gz
Go implementation for git-upload-pack
Diffstat (limited to 'go/internal/command/receivepack/receivepack_test.go')
-rw-r--r--go/internal/command/receivepack/receivepack_test.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/go/internal/command/receivepack/receivepack_test.go b/go/internal/command/receivepack/receivepack_test.go
index 874bac3..e5263f5 100644
--- a/go/internal/command/receivepack/receivepack_test.go
+++ b/go/internal/command/receivepack/receivepack_test.go
@@ -2,8 +2,6 @@ package receivepack
import (
"bytes"
- "encoding/json"
- "net/http"
"testing"
"github.com/stretchr/testify/require"
@@ -12,23 +10,11 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/go/internal/command/readwriter"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/gitlabnet/testserver"
+ "gitlab.com/gitlab-org/gitlab-shell/go/internal/testhelper/requesthandlers"
)
func TestForbiddenAccess(t *testing.T) {
- requests := []testserver.TestRequestHandler{
- {
- Path: "/api/v4/internal/allowed",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- body := map[string]interface{}{
- "status": false,
- "message": "Disallowed by API call",
- }
- w.WriteHeader(http.StatusForbidden)
- require.NoError(t, json.NewEncoder(w).Encode(body))
- },
- },
- }
-
+ requests := requesthandlers.BuildDisallowedByApiHandlers(t)
url, cleanup := testserver.StartHttpServer(t, requests)
defer cleanup()