(t *testing.T)
| 135 | } |
| 136 | |
| 137 | func 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 | } |
nothing calls this directly
no test coverage detected