Skip to content

Commit

Permalink
FALCON-2115 UT test failure on FalconCSRFFilterTest
Browse files Browse the repository at this point in the history
Need to add the property falcon.security.csrf.header to startup properties when testing custom header for CSRF filter.

Author: yzheng-hortonworks <yzheng@hortonworks.com>

Reviewers: "Sowmya Ramesh <sowmya_kr@apache.org>"

Closes apache#262 from yzheng-hortonworks/FALCON-2115
  • Loading branch information
yzheng-hortonworks authored and Pallavi Nagesha Rao committed Feb 16, 2018
1 parent 418cfc1 commit c649ae9
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void setUp() throws Exception {
@Test
public void testCSRFEnabledAllowedMethodFromBrowser() throws Exception {
StartupProperties.get().setProperty("falcon.security.csrf.enabled", "true");
StartupProperties.get().setProperty("falcon.security.csrf.header", FALCON_CSRF_HEADER_DEFAULT);
mockHeader("Mozilla/5.0", null);
mockGetMethod();
mockRunFilter();
Expand All @@ -67,6 +68,7 @@ public void testCSRFEnabledAllowedMethodFromBrowser() throws Exception {
@Test
public void testCSRFEnabledNoCustomHeaderFromBrowser() throws Exception {
StartupProperties.get().setProperty("falcon.security.csrf.enabled", "true");
StartupProperties.get().setProperty("falcon.security.csrf.header", FALCON_CSRF_HEADER_DEFAULT);
mockHeader("Mozilla/5.0", null);
mockDeleteMethod();
mockRunFilter();
Expand All @@ -77,6 +79,7 @@ public void testCSRFEnabledNoCustomHeaderFromBrowser() throws Exception {
@Test
public void testCSRFEnabledIncludeCustomHeaderFromBrowser() throws Exception {
StartupProperties.get().setProperty("falcon.security.csrf.enabled", "true");
StartupProperties.get().setProperty("falcon.security.csrf.header", FALCON_CSRF_HEADER_DEFAULT);
mockHeader("Mozilla/5.0", "");
mockDeleteMethod();
mockRunFilter();
Expand All @@ -87,6 +90,7 @@ public void testCSRFEnabledIncludeCustomHeaderFromBrowser() throws Exception {
@Test
public void testCSRFEnabledAllowNonBrowserInteractionWithoutHeader() throws Exception {
StartupProperties.get().setProperty("falcon.security.csrf.enabled", "true");
StartupProperties.get().setProperty("falcon.security.csrf.header", FALCON_CSRF_HEADER_DEFAULT);
mockHeader(null, null);
mockDeleteMethod();
mockRunFilter();
Expand All @@ -97,6 +101,7 @@ public void testCSRFEnabledAllowNonBrowserInteractionWithoutHeader() throws Exce
@Test
public void testCSRFDisabledAllowAnyMethodFromBrowser() throws Exception {
StartupProperties.get().setProperty("falcon.security.csrf.enabled", "false");
StartupProperties.get().setProperty("falcon.security.csrf.header", FALCON_CSRF_HEADER_DEFAULT);
mockHeader("Mozilla/5.0", null);
mockDeleteMethod();
mockRunFilter();
Expand Down

0 comments on commit c649ae9

Please sign in to comment.