X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Fclub%2Fwpia%2Fgigi%2Fpages%2Fwot%2FTestTTPAdmin.java;h=0e11f6df501c479c8b0d6fea2da5780c315e7368;hp=d518dea4e3c177986222730576e1e357c2872b57;hb=04dc0117995e534dfffcab544998c4ba77b9c434;hpb=5a1b7ee1d24604eaa2d0572f59555b5777e9c4eb diff --git a/tests/club/wpia/gigi/pages/wot/TestTTPAdmin.java b/tests/club/wpia/gigi/pages/wot/TestTTPAdmin.java index d518dea4..0e11f6df 100644 --- a/tests/club/wpia/gigi/pages/wot/TestTTPAdmin.java +++ b/tests/club/wpia/gigi/pages/wot/TestTTPAdmin.java @@ -4,6 +4,7 @@ import static org.junit.Assert.*; import java.io.IOException; import java.net.MalformedURLException; +import java.security.GeneralSecurityException; import org.junit.Test; @@ -22,21 +23,21 @@ public class TestTTPAdmin extends ClientTest { } @Test - public void testHasRight() throws IOException, GigiApiException { + public void testHasRight() throws IOException, GigiApiException, GeneralSecurityException, InterruptedException { testTTPAdmin(true); } @Test - public void testHasNoRight() throws IOException, GigiApiException { + public void testHasNoRight() throws IOException, GigiApiException, GeneralSecurityException, InterruptedException { testTTPAdmin(false); } - public void testTTPAdmin(boolean hasRight) throws IOException, GigiApiException { + public void testTTPAdmin(boolean hasRight) throws IOException, GigiApiException, GeneralSecurityException, InterruptedException { if (hasRight) { grant(u, Group.TTP_AGENT); } grant(u, TTPAdminPage.TTP_APPLICANT); - cookie = login(u.getEmail(), TEST_PASSWORD); + cookie = cookieWithCertificateLogin(u); assertEquals( !hasRight ? 403 : 200, fetchStatusCode(TTPAdminPage.PATH)); assertEquals( !hasRight ? 403 : 200, fetchStatusCode(TTPAdminPage.PATH + "/")); @@ -48,4 +49,11 @@ public class TestTTPAdmin extends ClientTest { private int fetchStatusCode(String path) throws MalformedURLException, IOException { return get(path).getResponseCode(); } + + @Test + public void testVerifyWithoutCertLogin() throws IOException { + cookie = login(u.getEmail(), TEST_PASSWORD); + loginCertificate = null; + assertEquals(403, get(cookie, TTPAdminPage.PATH).getResponseCode()); + } }