MCPcopy
hub / github.com/ory/keto / TestAuthorityRequest

Function TestAuthorityRequest

cmd/status/root_test.go:137–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestAuthorityRequest(t *testing.T) {
138 ts := client.NewTestServer(
139 t, []*namespace.Namespace{{Name: t.Name()}}, newStatusCmd,
140 driver.WithGRPCUnaryInterceptors(authInterceptor(":authority", "example.com")),
141 )
142 defer ts.Shutdown(t)
143
144 t.Run("case=no authority", func(t *testing.T) {
145 out := ts.Cmd.ExecExpectedErr(t)
146 assert.Contains(t, out, "not authorized")
147 })
148
149 t.Run("case=env authority", func(t *testing.T) {
150 t.Setenv("KETO_AUTHORITY", "example.com")
151 out := ts.Cmd.ExecNoErr(t)
152 assert.Contains(t, out, "SERVING")
153 })
154
155 t.Run("case=flag authority", func(t *testing.T) {
156 out := ts.Cmd.ExecNoErr(t, "--"+client.FlagAuthority, "example.com")
157 assert.Contains(t, out, "SERVING")
158 })
159}

Callers

nothing calls this directly

Calls 7

ShutdownMethod · 0.95
NewTestServerFunction · 0.92
authInterceptorFunction · 0.85
ExecExpectedErrMethod · 0.80
ExecNoErrMethod · 0.80
NameMethod · 0.45

Tested by

no test coverage detected