X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FTestSecurityHeaders.java;h=8149d322a22f21d917aeb91749630e701cc072e8;hb=d3fae2244debf99eb93281c7302e8bd397868c49;hp=75675c66f6fd44ecb6b5f7611b099dc7fafc40f6;hpb=2824d1c165c501e2f3a8809044788b33b81f478a;p=gigi.git diff --git a/tests/org/cacert/gigi/TestSecurityHeaders.java b/tests/org/cacert/gigi/TestSecurityHeaders.java index 75675c66..8149d322 100644 --- a/tests/org/cacert/gigi/TestSecurityHeaders.java +++ b/tests/org/cacert/gigi/TestSecurityHeaders.java @@ -1,29 +1,29 @@ package org.cacert.gigi; +import static org.junit.Assert.*; + import java.io.IOException; import java.net.HttpURLConnection; -import java.net.URL; import org.cacert.gigi.testUtils.ManagedTest; import org.junit.Test; -import static org.junit.Assert.*; - public class TestSecurityHeaders extends ManagedTest { - @Test - public void testSTS() throws IOException { - HttpURLConnection uc = (HttpURLConnection) new URL("https://" + getServerName()).openConnection(); - assertNotNull(uc.getHeaderField("Strict-Transport-Security")); - } - - public void testCSP() throws IOException { - HttpURLConnection uc = (HttpURLConnection) new URL("https://" + getServerName()).openConnection(); - assertNotNull(uc.getHeaderField("Content-Security-Policy")); - } - - public void testAllowOrigin() throws IOException { - HttpURLConnection uc = (HttpURLConnection) new URL("https://" + getServerName()).openConnection(); - assertNotNull(uc.getHeaderField("Access-Control-Allow-Origin")); - - } + + @Test + public void testSTS() throws IOException { + HttpURLConnection uc = get(null, "/"); + assertNotNull(uc.getHeaderField("Strict-Transport-Security")); + } + + public void testCSP() throws IOException { + HttpURLConnection uc = get(null, "/"); + assertNotNull(uc.getHeaderField("Content-Security-Policy")); + } + + public void testAllowOrigin() throws IOException { + HttpURLConnection uc = get(null, "/"); + assertNotNull(uc.getHeaderField("Access-Control-Allow-Origin")); + + } }