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

Method CreateDatabase

rest/utilities_testing.go:506–515  ·  view source on GitHub ↗

CreateDatabase is a utility function to create a database through the REST API

(dbName string, config DbConfig)

Source from the content-addressed store, hash-verified

504
505// CreateDatabase is a utility function to create a database through the REST API
506func (rt *RestTester) CreateDatabase(dbName string, config DbConfig) (resp *TestResponse) {
507 dbcJSON, err := base.JSONMarshal(config)
508 require.NoError(rt.TB(), err)
509 if rt.AdminInterfaceAuthentication {
510 resp = rt.SendAdminRequestWithAuth(http.MethodPut, fmt.Sprintf("/%s/", dbName), string(dbcJSON), base.TestClusterUsername(), base.TestClusterPassword())
511 } else {
512 resp = rt.SendAdminRequest(http.MethodPut, fmt.Sprintf("/%s/", dbName), string(dbcJSON))
513 }
514 return resp
515}
516
517// ReplaceDbConfig is a utility function to replace a database config through the REST API
518func (rt *RestTester) ReplaceDbConfig(dbName string, config DbConfig) *TestResponse {

Calls 6

TBMethod · 0.95
SendAdminRequestMethod · 0.95
JSONMarshalFunction · 0.92
TestClusterUsernameFunction · 0.92
TestClusterPasswordFunction · 0.92