CreateUser creates a user with the default password and channels scoped to a single test collection.
(username string, channels []string, roles ...string)
| 541 | |
| 542 | // CreateUser creates a user with the default password and channels scoped to a single test collection. |
| 543 | func (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. |
| 554 | func (rt *RestTester) CreateRole(rolename string, channels []string) { |