Tests to make sure login required is returned when admin auth is enabled
(t *testing.T)
| 1495 | |
| 1496 | // Tests to make sure login required is returned when admin auth is enabled |
| 1497 | func TestLoginRequiredForAdmin(t *testing.T) { |
| 1498 | if base.UnitTestUrlIsWalrus() { |
| 1499 | t.Skip("Hits CBS rest endpoint for permission check") |
| 1500 | } |
| 1501 | |
| 1502 | rt := NewRestTester(t, &RestTesterConfig{ |
| 1503 | AdminInterfaceAuthentication: true, |
| 1504 | }) |
| 1505 | defer rt.Close() |
| 1506 | |
| 1507 | username := "nonexistent" |
| 1508 | password := "nope" |
| 1509 | |
| 1510 | response := rt.SendAdminRequestWithAuth(http.MethodGet, "/{{.db}}/", "", username, password) |
| 1511 | |
| 1512 | RequireStatus(t, response, http.StatusUnauthorized) |
| 1513 | require.Contains(t, response.Body.String(), ErrInvalidLogin.Message) |
| 1514 | |
| 1515 | response = rt.SendAdminRequestWithAuth(http.MethodGet, "/notadb/", "", username, password) |
| 1516 | RequireStatus(t, response, http.StatusUnauthorized) |
| 1517 | require.Contains(t, response.Body.String(), ErrInvalidLogin.Message) |
| 1518 | } |
nothing calls this directly
no test coverage detected