diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/api/api_test.go | 24 | ||||
| -rw-r--r-- | internal/test/server.go | 3 |
2 files changed, 12 insertions, 15 deletions
diff --git a/internal/api/api_test.go b/internal/api/api_test.go index fcf02e9..2d17e96 100644 --- a/internal/api/api_test.go +++ b/internal/api/api_test.go @@ -177,7 +177,6 @@ func createTestAPI(t *testing.T, tok *eduoauth.Token, gt []string, hps []test.Ha "v": "0.0.0" } `, listen.Addr().String()), - ResponseCode: 200, }, { Path: "/test-token-endpoint", @@ -284,7 +283,6 @@ func TestAPIInfo(t *testing.T) { } } `, - ResponseCode: 200, }, info: &profiles.Info{ Info: profiles.ListInfo{ @@ -318,7 +316,6 @@ func TestAPIInfo(t *testing.T) { } } `, - ResponseCode: 200, }, info: &profiles.Info{ Info: profiles.ListInfo{ @@ -386,20 +383,18 @@ func TestAPIConnect(t *testing.T) { }{ { hp: test.HandlerPath{ - Method: http.MethodPost, - Path: "/test-api-endpoint/connect", - Response: ``, - ResponseCode: 200, + Method: http.MethodPost, + Path: "/test-api-endpoint/connect", + Response: ``, }, cd: nil, err: ErrNoProtocols, }, { hp: test.HandlerPath{ - Method: http.MethodPost, - Path: "/test-api-endpoint/connect", - Response: ``, - ResponseCode: 200, + Method: http.MethodPost, + Path: "/test-api-endpoint/connect", + Response: ``, }, cd: nil, protos: []protocol.Protocol{protocol.Unknown}, @@ -407,10 +402,9 @@ func TestAPIConnect(t *testing.T) { }, { hp: test.HandlerPath{ - Method: http.MethodPost, - Path: "/test-api-endpoint/connect", - Response: ``, - ResponseCode: 200, + Method: http.MethodPost, + Path: "/test-api-endpoint/connect", + Response: ``, }, cd: nil, protos: []protocol.Protocol{protocol.OpenVPN, protocol.WireGuard, protocol.Unknown}, diff --git a/internal/test/server.go b/internal/test/server.go index b6e03af..2f01c06 100644 --- a/internal/test/server.go +++ b/internal/test/server.go @@ -60,6 +60,9 @@ func NewServerWithHandles(hps []HandlerPath, listener net.Listener) *Server { mux := http.NewServeMux() for _, hp := range hps { hp := hp + if hp.ResponseCode == 0 { + hp.ResponseCode = 200 + } mux.HandleFunc(hp.Path, hp.HandlerFunc()) } return NewServer(mux, listener) |
