(t *testing.T)
| 2937 | } |
| 2938 | |
| 2939 | func TestNotExistentDBRequest(t *testing.T) { |
| 2940 | if base.UnitTestUrlIsWalrus() { |
| 2941 | t.Skip("Test requires Couchbase Server") |
| 2942 | } |
| 2943 | |
| 2944 | rt := rest.NewRestTester(t, &rest.RestTesterConfig{AdminInterfaceAuthentication: true}) |
| 2945 | defer rt.Close() |
| 2946 | |
| 2947 | eps, httpClient, err := rt.ServerContext().ObtainManagementEndpointsAndHTTPClient() |
| 2948 | require.NoError(t, err) |
| 2949 | |
| 2950 | rest.MakeUser(t, httpClient, eps[0], "random", "password", nil) |
| 2951 | defer rest.DeleteUser(t, httpClient, eps[0], "random") |
| 2952 | |
| 2953 | // Request to non-existent db with valid credentials |
| 2954 | resp := rt.SendAdminRequestWithAuth("PUT", "/dbx/_config", "", "random", "password") |
| 2955 | rest.RequireStatus(t, resp, http.StatusForbidden) |
| 2956 | |
| 2957 | // Request to non-existent db with invalid credentials |
| 2958 | resp = rt.SendAdminRequestWithAuth("PUT", "/dbx/_config", "", "random", "passwordx") |
| 2959 | rest.RequireStatus(t, resp, http.StatusUnauthorized) |
| 2960 | require.Contains(t, resp.Body.String(), rest.ErrInvalidLogin.Message) |
| 2961 | } |
| 2962 | |
| 2963 | func TestConfigsIncludeDefaults(t *testing.T) { |
| 2964 | base.ResetGlobalTestLogging(t) |
nothing calls this directly
no test coverage detected