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 17:26:11 UTC
[2/2] 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/3164f040
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/3164f040
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/3164f040
Branch: refs/heads/1.2.x-fixes
Commit: 3164f0405f644cac5bf1fbcc64da58392e696df1
Parents: 94a6178
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 17:26:06 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/3164f040/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 f1b92c3..3481c34 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
@@ -732,30 +732,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();
@@ -764,6 +740,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();