mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +02:00
feat(unit-testing): add a mock for the RequestBouncer EE-5610 (#9089)
This commit is contained in:
parent
933e764a13
commit
f7dd73b0f7
42 changed files with 147 additions and 126 deletions
|
@ -4,10 +4,10 @@ import (
|
|||
"net/http"
|
||||
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
"github.com/portainer/portainer/api/dataservices"
|
||||
)
|
||||
|
||||
type testRequestBouncer struct {
|
||||
}
|
||||
type testRequestBouncer struct{}
|
||||
|
||||
// NewTestRequestBouncer creates new mock for requestBouncer
|
||||
func NewTestRequestBouncer() *testRequestBouncer {
|
||||
|
@ -30,6 +30,14 @@ func (testRequestBouncer) PublicAccess(h http.Handler) http.Handler {
|
|||
return h
|
||||
}
|
||||
|
||||
func (testRequestBouncer) TeamLeaderAccess(h http.Handler) http.Handler {
|
||||
return h
|
||||
}
|
||||
|
||||
func (testRequestBouncer) EdgeComputeOperation(h http.Handler) http.Handler {
|
||||
return h
|
||||
}
|
||||
|
||||
func (testRequestBouncer) AuthorizedEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
|
||||
return nil
|
||||
}
|
||||
|
@ -37,3 +45,11 @@ func (testRequestBouncer) AuthorizedEndpointOperation(r *http.Request, endpoint
|
|||
func (testRequestBouncer) AuthorizedEdgeEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (testRequestBouncer) TrustedEdgeEnvironmentAccess(tx dataservices.DataStoreTx, endpoint *portainer.Endpoint) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (testRequestBouncer) JWTAuthLookup(r *http.Request) *portainer.TokenData {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue