Skip to content

Commit

Permalink
LPD-35246 Here we can state the expectation
Browse files Browse the repository at this point in the history
  • Loading branch information
stian-sigvartsen authored and brianchandotcom committed Sep 6, 2024
1 parent bd21633 commit a6bdcb8
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.liferay.arquillian.extension.junit.bridge.junit.Arquillian;
import com.liferay.portal.configuration.test.util.CompanyConfigurationTemporarySwapper;
import com.liferay.portal.kernel.test.rule.AggregateTestRule;
import com.liferay.portal.kernel.test.util.RandomTestUtil;
import com.liferay.portal.kernel.test.util.TestPropsValues;
import com.liferay.portal.kernel.util.HashMapDictionaryBuilder;
import com.liferay.portal.kernel.util.StringUtil;
Expand Down Expand Up @@ -43,13 +44,13 @@ public class ContentSecurityPolicyFilterTest {
new LiferayIntegrationTestRule();

@Test
public void testIsFilterEnabled() throws Exception {
public void testNotNeededForDocrootHtmlResources() throws Exception {
try (CompanyConfigurationTemporarySwapper
configurationTemporarySwapper =
_getCompanyConfigurationTemporarySwapper(false, null, "")) {

HttpURLConnection httpURLConnection = _openHttpURLConnection(
"http://localhost:8080/html/icons/flags.png");
"http://localhost:8080/html/" + RandomTestUtil.randomString());

Map<String, List<String>> headerFields =
httpURLConnection.getHeaderFields();
Expand All @@ -70,13 +71,9 @@ public void testProcessFilter() throws Exception {
HttpURLConnection httpURLConnection = _openHttpURLConnection(
"http://localhost:8080/web/guest");

System.out.println("httpURLConnection: " + httpURLConnection);

Map<String, List<String>> headerFields =
httpURLConnection.getHeaderFields();

System.out.println("headerFields: " + headerFields);

Assert.assertFalse(
headerFields.containsKey("Content-Security-Policy"));

Expand Down

0 comments on commit a6bdcb8

Please sign in to comment.