(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func TestCheckPermissionsWithX509(t *testing.T) { |
| 141 | serverURL := base.UnitTestUrl() |
| 142 | if !base.ServerIsTLS(serverURL) { |
| 143 | t.Skipf("URI %s needs to start with couchbases://", serverURL) |
| 144 | } |
| 145 | ctx := base.TestCtx(t) |
| 146 | tb, caCertPath, certPath, keyPath := setupX509Tests(t, true) |
| 147 | defer tb.Close(ctx) |
| 148 | |
| 149 | svrctx := NewServerContext(ctx, &StartupConfig{ |
| 150 | Bootstrap: BootstrapConfig{ |
| 151 | Server: serverURL, |
| 152 | X509CertPath: certPath, |
| 153 | X509KeyPath: keyPath, |
| 154 | CACertPath: caCertPath, |
| 155 | }, |
| 156 | }, false) |
| 157 | defer svrctx.Close(ctx) |
| 158 | |
| 159 | goCBAgent, err := svrctx.initializeGoCBAgent(ctx) |
| 160 | require.NoError(t, err) |
| 161 | svrctx.GoCBAgent = goCBAgent |
| 162 | |
| 163 | noX509HttpClient, err := svrctx.initializeNoX509HttpClient(ctx) |
| 164 | require.NoError(t, err) |
| 165 | svrctx.NoX509HTTPClient = noX509HttpClient |
| 166 | |
| 167 | eps, httpClient, err := svrctx.ObtainManagementEndpointsAndHTTPClient() |
| 168 | assert.NoError(t, err) |
| 169 | |
| 170 | statusCode, _, err := CheckPermissions(ctx, httpClient, eps, "", base.TestClusterUsername(), base.TestClusterPassword(), []Permission{Permission{"!admin", false}}, nil) |
| 171 | assert.NoError(t, err) |
| 172 | |
| 173 | assert.Equal(t, http.StatusOK, statusCode) |
| 174 | } |
| 175 | |
| 176 | func TestCheckRoles(t *testing.T) { |
| 177 | if base.UnitTestUrlIsWalrus() { |
nothing calls this directly
no test coverage detected