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=2e3c386284d776c8b8b3d6a37919aa0fbd7b2778;hb=04dc0117995e534dfffcab544998c4ba77b9c434;hpb=bccd4cc0dba0f89aa045b113bac46eb8cc1dab4e diff --git a/tests/club/wpia/gigi/pages/wot/TestTTPAdmin.java b/tests/club/wpia/gigi/pages/wot/TestTTPAdmin.java index 2e3c3862..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_ASSURER); + 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()); + } }