diff options
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/authz/server_test.go | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/pkg/authz/server_test.go b/pkg/authz/server_test.go index 6740eda..c612146 100644 --- a/pkg/authz/server_test.go +++ b/pkg/authz/server_test.go @@ -18,6 +18,8 @@ import ( "google.golang.org/grpc/test/bufconn" ) +type HTTPRequest = auth.AttributeContext_HttpRequest + func TestServer(t *testing.T) { idp := web.NewOIDCServer(t) defer idp.Close() @@ -55,25 +57,25 @@ func TestServer(t *testing.T) { t.Run("CheckRequest", func(t *testing.T) { tt := []struct { - http *auth.AttributeContext_HttpRequest + http *HTTPRequest status codes.Code }{ - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/application.js"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/callback"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/dashboard", Headers: loggedInHeaders}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/dashboard/nav"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/favicon.ico"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/favicon.png"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/health"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/index.html"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/logo.png"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/signout"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/sparkles"}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "POST", Path: "/sparkles", Headers: loggedInHeaders}}, - {status: codes.OK, http: &auth.AttributeContext_HttpRequest{Method: "POST", Path: "/sparkles/restore"}}, - {status: codes.PermissionDenied, http: &auth.AttributeContext_HttpRequest{Method: "GET", Path: "/dashboard"}}, - {status: codes.PermissionDenied, http: &auth.AttributeContext_HttpRequest{Method: "POST", Path: "/sparkles"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/application.js"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/callback"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/dashboard", Headers: loggedInHeaders}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/dashboard/nav"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/favicon.ico"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/favicon.png"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/health"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/index.html"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/logo.png"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/signout"}}, + {status: codes.OK, http: &HTTPRequest{Method: "GET", Path: "/sparkles"}}, + {status: codes.OK, http: &HTTPRequest{Method: "POST", Path: "/sparkles", Headers: loggedInHeaders}}, + {status: codes.OK, http: &HTTPRequest{Method: "POST", Path: "/sparkles/restore"}}, + {status: codes.PermissionDenied, http: &HTTPRequest{Method: "GET", Path: "/dashboard"}}, + {status: codes.PermissionDenied, http: &HTTPRequest{Method: "POST", Path: "/sparkles"}}, } for _, example := range tt { |
