Skip to content

Commit

Permalink
Merge pull request #857 from Wadeck/adapt-tests-for-2.204.6
Browse files Browse the repository at this point in the history
Adapt the test for recent core
  • Loading branch information
MarkEWaite authored Mar 29, 2020
2 parents cc33ed0 + 965e00f commit 5b3300d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/java/hudson/plugins/git/GitStatusCrumbExclusionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import hudson.security.csrf.CrumbFilter;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;

Expand Down Expand Up @@ -32,6 +34,23 @@ public class GitStatusCrumbExclusionTest {
private HttpServletResponse resp;
private FilterChain chain;

private static String systemPropertyPreviousValue;

@BeforeClass
public static void setProps() {
systemPropertyPreviousValue = System.getProperty("hudson.security.csrf.CrumbFilter.UNPROCESSED_PATHINFO");
System.setProperty("hudson.security.csrf.CrumbFilter.UNPROCESSED_PATHINFO", "true");
}

@AfterClass
public static void unsetProps() {
if (systemPropertyPreviousValue == null) {
System.clearProperty("hudson.security.csrf.CrumbFilter.UNPROCESSED_PATHINFO");
} else {
System.setProperty("hudson.security.csrf.CrumbFilter.UNPROCESSED_PATHINFO", systemPropertyPreviousValue);
}
}

@Before
public void before() {
filter = new CrumbFilter();
Expand Down

0 comments on commit 5b3300d

Please sign in to comment.