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

Function TestAdminAPIAuth

rest/admin_api_auth_test.go:479–911  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

477}
478
479func TestAdminAPIAuth(t *testing.T) {
480 base.LongRunningTest(t)
481
482 // Don't really care about the log level but this test hits the logging endpoint so this is used to reset the logging
483 base.SetUpTestLogging(t, base.LevelInfo, base.KeyNone)
484
485 if base.UnitTestUrlIsWalrus() {
486 t.Skip("This test only works against Couchbase Server")
487 }
488 serverURL := base.UnitTestUrl()
489 if base.ServerIsTLS(serverURL) {
490 t.Skipf("URI %s can not start with couchbases://", serverURL)
491 }
492
493 rt := NewRestTester(t, &RestTesterConfig{
494 AdminInterfaceAuthentication: true,
495 metricsInterfaceAuthentication: true,
496 })
497 defer rt.Close()
498
499 // init RT bucket so we can get the config
500 _ = rt.Bucket()
501 dbConfig := rt.DatabaseConfig
502 dbConfigRaw, err := base.JSONMarshal(dbConfig)
503 require.NoError(t, err)
504
505 endPoints := []struct {
506 Method string
507 Endpoint string
508 SkipSuccessTest bool
509 body string // The body to use in requests. Default: `{}`
510 }{
511 {
512 Method: "POST",
513 Endpoint: "/{{.db}}/_session",
514 },
515 {
516 Method: "GET",
517 Endpoint: "/{{.db}}/_session/id",
518 },
519 {
520 Method: "DELETE",
521 Endpoint: "/{{.db}}/_session/id",
522 },
523 {
524 Method: "GET",
525 Endpoint: "/{{.keyspace}}/_raw/doc",
526 },
527 {
528 Method: "GET",
529 Endpoint: "/{{.db}}/_user/",
530 },
531 {
532 Method: "POST",
533 Endpoint: "/{{.db}}/_user/",
534 },
535 {
536 Method: "GET",

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
BucketMethod · 0.95
ServerContextMethod · 0.95
RunMethod · 0.95
SendAdminRequestMethod · 0.95
LongRunningTestFunction · 0.92
SetUpTestLoggingFunction · 0.92
UnitTestUrlIsWalrusFunction · 0.92
UnitTestUrlFunction · 0.92
ServerIsTLSFunction · 0.92
JSONMarshalFunction · 0.92

Tested by

no test coverage detected