1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-17 00:17:40 +02:00
Files
.github
contrib
docs
pkg
apis
app
authentication
clock
cookies
encryption
header
http
ip
logger
middleware
testdata
basic_session.go
basic_session_test.go
headers.go
headers_test.go
healthcheck.go
healthcheck_test.go
jwt_session.go
jwt_session_test.go
metrics.go
metrics_test.go
middleware_suite_test.go
redirect_to_https.go
redirect_to_https_test.go
request_logger.go
request_logger_test.go
scope.go
scope_test.go
session_utils.go
session_utils_test.go
stored_session.go
stored_session_test.go
requests
sessions
upstream
util
validation
providers
testdata
tools
.dockerignore
.gitignore
.golangci.yml
CHANGELOG.md
CONTRIBUTING.md
Dockerfile
Dockerfile.arm64
Dockerfile.armv6
LICENSE
MAINTAINERS
Makefile
README.md
RELEASE.md
SECURITY.md
dist.sh
go.mod
go.sum
main.go
main_suite_test.go
main_test.go
nsswitch.conf
oauthproxy.go
oauthproxy_test.go
validator.go
validator_test.go
version.go
watcher.go
watcher_unsupported.go
oauth2-proxy/pkg/middleware/middleware_suite_test.go

37 lines
836 B
Go
Raw Permalink Normal View History

2020-06-14 16:42:05 +01:00
package middleware
import (
"net/http"
2020-06-14 16:42:05 +01:00
"testing"
middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger"
2020-06-14 16:42:05 +01:00
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestMiddlewareSuite(t *testing.T) {
logger.SetOutput(GinkgoWriter)
logger.SetErrOutput(GinkgoWriter)
2020-06-14 16:42:05 +01:00
RegisterFailHandler(Fail)
RunSpecs(t, "Middleware")
}
func testHandler() http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
rw.WriteHeader(200)
rw.Write([]byte("test"))
})
}
func testUpstreamHandler(upstream string) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
scope := middlewareapi.GetRequestScope(req)
scope.Upstream = upstream
rw.WriteHeader(200)
rw.Write([]byte("test"))
})
}