Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing JENKINS-26234 by excluding crumb requirement for /bitbucket-hook
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/test/java/com/cloudbees/jenkins/plugins/CrumbExclusionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.cloudbees.jenkins.plugins; | ||
|
||
import com.gargoylesoftware.htmlunit.HttpMethod; | ||
import com.gargoylesoftware.htmlunit.WebRequestSettings; | ||
import com.gargoylesoftware.htmlunit.WebResponse; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
import org.xml.sax.SAXException; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class CrumbExclusionTest { | ||
@Rule | ||
public JenkinsRule jenkins = new JenkinsRule(); | ||
|
||
@Test | ||
public void shouldNotRequireACrumbForTheBitbucketHookUrl() throws IOException, SAXException { | ||
JenkinsRule.WebClient webClient = jenkins.createWebClient(); | ||
WebRequestSettings wrs = new WebRequestSettings(new URL(webClient.getContextPath() + "bitbucket-hook"), | ||
HttpMethod.POST); | ||
WebResponse resp = webClient.getPage(wrs).getWebResponse(); | ||
|
||
assertEquals(resp.getStatusCode(), 200); | ||
} | ||
} |