You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2018/05/04 08:24:16 UTC

[sling-org-apache-sling-launchpad-integration-tests] branch master updated: SLING-7636 - make testGetDefaultLoginPage less brittle, just check for non-error codes and ignore redirects and auth

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-integration-tests.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c533f5  SLING-7636 - make testGetDefaultLoginPage less brittle, just check for non-error codes and ignore redirects and auth
3c533f5 is described below

commit 3c533f50863365637ea01265b3fc3320cf42ad8b
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri May 4 10:24:08 2018 +0200

    SLING-7636 - make testGetDefaultLoginPage less brittle, just check for non-error codes and ignore redirects and auth
---
 .../webapp/integrationtest/login/RedirectOnLoginErrorTest.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java
index d8d3d74..cbceee5 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java
@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.sling.commons.testing.integration.HttpTestBase;
 
@@ -100,6 +101,13 @@ public class RedirectOnLoginErrorTest extends HttpTestBase {
      */
     public void testGetDefaultLoginPage() throws Exception {
         final String loginPageUrl = String.format("%s/system/sling/login", HTTP_BASE_URL);
-        assertHttpStatus(loginPageUrl, HttpServletResponse.SC_OK);
+        final GetMethod get = new GetMethod(loginPageUrl);
+        get.setFollowRedirects(false);
+        get.setDoAuthentication(false);
+        final int status = httpClient.executeMethod(get);
+        final int family = status / 10;
+        if(family != 20 && family != 30) {
+            fail("Expected 20x or 30x status, got " + status + " at " + loginPageUrl);
+        }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
bdelacretaz@apache.org.