(t *testing.T)
| 1463 | } |
| 1464 | |
| 1465 | func TestCreateDBSpecificBucketPerm(t *testing.T) { |
| 1466 | if base.UnitTestUrlIsWalrus() { |
| 1467 | t.Skip("This test only works against Couchbase Server") |
| 1468 | } |
| 1469 | |
| 1470 | base.RequireNumTestBuckets(t, 2) |
| 1471 | |
| 1472 | tb := base.GetTestBucket(t) |
| 1473 | ctx := base.TestCtx(t) |
| 1474 | defer tb.Close(ctx) |
| 1475 | |
| 1476 | rt := NewRestTester(t, &RestTesterConfig{ |
| 1477 | AdminInterfaceAuthentication: true, |
| 1478 | }) |
| 1479 | defer rt.Close() |
| 1480 | |
| 1481 | SGWorBFArole := RouteRole{MobileSyncGatewayRole.RoleName, true} |
| 1482 | if base.TestsUseServerCE() { |
| 1483 | SGWorBFArole = RouteRole{BucketFullAccessRole.RoleName, true} |
| 1484 | } |
| 1485 | |
| 1486 | eps, httpClient, err := rt.ServerContext().ObtainManagementEndpointsAndHTTPClient() |
| 1487 | require.NoError(t, err) |
| 1488 | |
| 1489 | MakeUser(t, httpClient, eps[0], SGWorBFArole.RoleName, "password", []string{fmt.Sprintf("%s[%s]", SGWorBFArole.RoleName, tb.GetName())}) |
| 1490 | defer DeleteUser(t, httpClient, eps[0], SGWorBFArole.RoleName) |
| 1491 | |
| 1492 | resp := rt.SendAdminRequestWithAuth("PUT", "/db2/", `{"bucket": "`+tb.GetName()+`", "username": "`+base.TestClusterUsername()+`", "password": "`+base.TestClusterPassword()+`", "num_index_replicas": 0, "use_views": `+strconv.FormatBool(base.TestsDisableGSI())+`}`, SGWorBFArole.RoleName, "password") |
| 1493 | RequireStatus(t, resp, http.StatusCreated) |
| 1494 | } |
| 1495 | |
| 1496 | // Tests to make sure login required is returned when admin auth is enabled |
| 1497 | func TestLoginRequiredForAdmin(t *testing.T) { |
nothing calls this directly
no test coverage detected