From 3c952789e2f440b81e1822f352f155b9a74dc790 Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Tue, 16 Jul 2024 16:03:46 -0700 Subject: [PATCH 1/3] Update expected failed auth message --- src/org/labkey/test/tests/ClientAPITest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/labkey/test/tests/ClientAPITest.java b/src/org/labkey/test/tests/ClientAPITest.java index 24dfb8be30..577ec82153 100644 --- a/src/org/labkey/test/tests/ClientAPITest.java +++ b/src/org/labkey/test/tests/ClientAPITest.java @@ -1418,7 +1418,7 @@ public void contentTypeResponseTest() Map expectedProps = new HashMap<>(); expectedProps.put("success", false); - expectedProps.put("exception", "You must log in to view this content."); + expectedProps.put("exception", "The email address and password you entered did not match any accounts on file."); validateUnauthorizedResponses(cn, command, expectedProps); @@ -1506,7 +1506,7 @@ protected HttpGet getHttpRequest(Connection connection, String folderPath) throw assertThat(responseContentType, containsString(expectedResponseContentType)); // Command only supports parsing the body of a JSON response. - if ("application/json".equalsIgnoreCase(expectedResponseContentType) && expectedProps != null && expectedProps.size() > 0) + if ("application/json".equalsIgnoreCase(expectedResponseContentType) && expectedProps != null && !expectedProps.isEmpty()) { Map body = exception.getProperties(); From 985bcfce53ee9e2a6ca1b104b2192ed015449430 Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Tue, 16 Jul 2024 16:29:19 -0700 Subject: [PATCH 2/3] Don't pass in credentials before initial user is set --- src/org/labkey/test/LabKeySiteWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/labkey/test/LabKeySiteWrapper.java b/src/org/labkey/test/LabKeySiteWrapper.java index d02752a68f..84d712ac79 100644 --- a/src/org/labkey/test/LabKeySiteWrapper.java +++ b/src/org/labkey/test/LabKeySiteWrapper.java @@ -535,7 +535,7 @@ private void waitForStartup() try { String startPage = buildURL("project", "home", "start"); - SimpleHttpResponse httpResponse = WebTestHelper.getHttpResponse(startPage); + SimpleHttpResponse httpResponse = WebTestHelper.getHttpResponse(startPage, null, null); if (httpResponse.getResponseCode() >= 400) { log("Waiting for server: " + httpResponse.getResponseCode()); From e420bec165ab683ccf6ea5c40fbe5fc324cdde76 Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Tue, 16 Jul 2024 17:21:26 -0700 Subject: [PATCH 3/3] Really don't pass in credentials before initial user is set --- src/org/labkey/test/util/SimpleHttpRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/labkey/test/util/SimpleHttpRequest.java b/src/org/labkey/test/util/SimpleHttpRequest.java index 4383702538..d2661989da 100644 --- a/src/org/labkey/test/util/SimpleHttpRequest.java +++ b/src/org/labkey/test/util/SimpleHttpRequest.java @@ -114,7 +114,7 @@ protected PasswordAuthentication getPasswordAuthentication() { useCopiedSession(con); } - else + else if (_username != null && _password != null) { // Authenticator.setDefault() call above doesn't seem to work (I don't know why), so add the basic auth header explicitly String encoded = Base64.getEncoder().encodeToString((_username + ":" + _password).getBytes(StandardCharsets.UTF_8));