summaryrefslogtreecommitdiff
path: root/pkg/authz
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-23 15:41:13 -0600
committermo khan <mo@mokhan.ca>2025-05-23 15:41:13 -0600
commit86ad4fe8bf4bfde9bbe31a63431a508f81032527 (patch)
tree96e61f1267a441fac9c3fb4881fb606822d93d1c /pkg/authz
parent4e3bfcf1e641d41cb7f02bad7a8fd8759e5fb6ad (diff)
test: extract alias for HTTP Request
Diffstat (limited to 'pkg/authz')
-rw-r--r--pkg/authz/server_test.go36
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 {