incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1021342 - /sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/auth/AuthenticationResponseCodeTest.java
Date Mon, 11 Oct 2010 13:29:48 GMT
Author: fmeschbe
Date: Mon Oct 11 13:29:47 2010
New Revision: 1021342

URL: http://svn.apache.org/viewvc?rev=1021342&view=rev
Log:
SLING-1831 expect response content to match the X-Reason header value

Modified:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/auth/AuthenticationResponseCodeTest.java

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/auth/AuthenticationResponseCodeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/auth/AuthenticationResponseCodeTest.java?rev=1021342&r1=1021341&r2=1021342&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/auth/AuthenticationResponseCodeTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/auth/AuthenticationResponseCodeTest.java
Mon Oct 11 13:29:47 2010
@@ -80,8 +80,13 @@ public class AuthenticationResponseCodeT
         headers.add(new Header("Cookie", "sling.formauth=garbage"));
 
         HttpMethod post = assertPostStatus(HTTP_BASE_URL + "/j_security_check", HttpServletResponse.SC_FORBIDDEN,
params, headers, null);
-        assertNotNull(post.getResponseHeader("X-Reason"));
-        assertTrue(post.getResponseBodyAsString().length() == 0);
+
+        // expected the X-Reason header
+        final Header reason = post.getResponseHeader("X-Reason");
+        assertNotNull(reason);
+
+        // expect the response to be the same as the reason (SLING-1831)
+        assertEquals(reason.getValue(), post.getResponseBodyAsString().trim());
     }
 
     public void testValidatingIncorrectHttpBasicCredentials() throws Exception {
@@ -94,12 +99,22 @@ public class AuthenticationResponseCodeT
         List<NameValuePair> params = new ArrayList<NameValuePair>();
         params.add(new NameValuePair("j_validate", "true"));
         HttpMethod post = assertPostStatus(HTTP_BASE_URL + "/j_security_check", HttpServletResponse.SC_FORBIDDEN,
params, null);
-        assertTrue(post.getResponseBodyAsString().length() == 0);
-        assertNotNull(post.getResponseHeader("X-Reason"));
+
+        // expected the X-Reason header
+        Header reason = post.getResponseHeader("X-Reason");
+        assertNotNull(reason);
+
+        // expect the response to be the same as the reason (SLING-1831)
+        assertEquals(reason.getValue(), post.getResponseBodyAsString().trim());
 
         HttpMethod get = assertHttpStatus(HTTP_BASE_URL + "?j_validate=true", HttpServletResponse.SC_FORBIDDEN);
-        assertTrue(get.getResponseBodyAsString().length() == 0);
-        assertNotNull(get.getResponseHeader("X-Reason"));
+
+        // expected the X-Reason header
+        reason = post.getResponseHeader("X-Reason");
+        assertNotNull(reason);
+
+        // expect the response to be the same as the reason (SLING-1831)
+        assertEquals(reason.getValue(), post.getResponseBodyAsString().trim());
     }
 
     public void testXRequestedWithIncorrectCredentials() throws Exception {



Mime
View raw message