cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [3/4] cxf-fediz git commit: Another change to the test
Date Fri, 16 Dec 2016 16:57:40 GMT
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 <coheigea@apache.org>
Authored: Fri Dec 16 16:56:55 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@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();


Mime
View raw message