MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / CreateUser

Method CreateUser

rest/utilities_testing.go:543–551  ·  view source on GitHub ↗

CreateUser creates a user with the default password and channels scoped to a single test collection.

(username string, channels []string, roles ...string)

Source from the content-addressed store, hash-verified

541
542// CreateUser creates a user with the default password and channels scoped to a single test collection.
543func (rt *RestTester) CreateUser(username string, channels []string, roles ...string) {
544 var response *TestResponse
545 if rt.AdminInterfaceAuthentication {
546 response = rt.SendAdminRequestWithAuth(http.MethodPut, "/{{.db}}/_user/"+username, GetUserPayload(rt.TB(), "", RestTesterDefaultUserPassword, "", rt.GetSingleDataStore(), channels, roles), base.TestClusterUsername(), base.TestClusterPassword())
547 } else {
548 response = rt.SendAdminRequest(http.MethodPut, "/{{.db}}/_user/"+username, GetUserPayload(rt.TB(), "", RestTesterDefaultUserPassword, "", rt.GetSingleDataStore(), channels, roles))
549 }
550 RequireStatus(rt.TB(), response, http.StatusCreated)
551}
552
553// CreateRole creates a role with channels scoped to a single test collection.
554func (rt *RestTester) CreateRole(rolename string, channels []string) {

Calls 8

TBMethod · 0.95
GetSingleDataStoreMethod · 0.95
SendAdminRequestMethod · 0.95
TestClusterUsernameFunction · 0.92
TestClusterPasswordFunction · 0.92
GetUserPayloadFunction · 0.85
RequireStatusFunction · 0.85