You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2016/12/16 16:57:40 UTC

[3/4] cxf-fediz git commit: Another change to the test

Another change to the test


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/c221ec24
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/c221ec24
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/c221ec24

Branch: refs/heads/master
Commit: c221ec24e1a421a80cbfa9c74c693bf5749b0b30
Parents: 3545025
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Dec 16 16:56:55 2016 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Dec 16 16:56:55 2016 +0000

----------------------------------------------------------------------
 .../fediz/integrationtests/AbstractTests.java   | 27 +++-----------------
 1 file changed, 3 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/c221ec24/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
----------------------------------------------------------------------
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
index cf9edbc..8daaa14 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
@@ -788,30 +788,6 @@ public abstract class AbstractTests {
             }
         }
         
-        webClient.getOptions().setJavaScriptEnabled(false);
-        try {
-            HtmlPage rpPage2 = webClient.getPage(request);
-            String bodyTextContent = rpPage2.getBody().getTextContent();
-            Assert.assertTrue("Principal not " + user,
-                              bodyTextContent.contains("userPrincipal=" + user));
-            Assert.fail("Failure expected on a CSRF attack");
-        } catch (FailingHttpStatusCodeException ex) {
-            // expected
-        }
-        
-        // Send without context...
-        request = new WebRequest(new URL(url), HttpMethod.POST);
-        request.setRequestParameters(new ArrayList<NameValuePair>());
-        
-        for (DomElement result : results) {
-            if ("wresult".equals(result.getAttributeNS(null, "name"))
-                || "wa".equals(result.getAttributeNS(null, "name"))) {
-                String value = result.getAttributeNS(null, "value");
-                request.getRequestParameters().add(new NameValuePair(result.getAttributeNS(null, "name"), value));
-            }
-        }
-        
-        webClient.getOptions().setJavaScriptEnabled(false);
         try {
             HtmlPage rpPage2 = webClient.getPage(request);
             String bodyTextContent = rpPage2.getBody().getTextContent();
@@ -820,6 +796,9 @@ public abstract class AbstractTests {
             Assert.fail("Failure expected on a CSRF attack");
         } catch (FailingHttpStatusCodeException ex) {
             // expected
+            Assert.assertTrue(ex.getMessage().contains("401 Unauthorized")
+                              || ex.getMessage().contains("401 Authentication Failed")
+                              || ex.getMessage().contains("403 Forbidden"));
         }
         
         // webClient.close();