X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FLoginTest.java;h=940664fa79052cf1ea60d055b0d8dfef196cf0f7;hb=48b552dcb661a6ba039e6b28bea50655667c70f9;hp=f4bfe85fb5e71fa622d83cd46806dc30370c998c;hpb=2824d1c165c501e2f3a8809044788b33b81f478a;p=gigi.git diff --git a/tests/org/cacert/gigi/LoginTest.java b/tests/org/cacert/gigi/LoginTest.java index f4bfe85f..940664fa 100644 --- a/tests/org/cacert/gigi/LoginTest.java +++ b/tests/org/cacert/gigi/LoginTest.java @@ -2,41 +2,26 @@ package org.cacert.gigi; import java.io.IOException; import static org.junit.Assert.*; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLEncoder; - import org.cacert.gigi.testUtils.ManagedTest; import org.junit.Test; public class LoginTest extends ManagedTest { - public static final String secureReference = "/account/certs/email"; - - @Test - public void testLoginUnverified() throws IOException { - long uniq = System.currentTimeMillis(); - String email = "system" + uniq + "@testmail.org"; - String pw = "1'aAaA"; - registerUser("an", "bn", email, pw); - waitForMail(); - assertFalse(isLoggedin(login(email, pw))); - } - @Test - public void testLoginVerified() throws IOException { - long uniq = System.currentTimeMillis(); - String email = "system2" + uniq + "@testmail.org"; - String pw = "1'aAaA"; - createVerifiedUser("an", "bn", email, pw); - assertTrue(isLoggedin(login(email, pw))); - } + @Test + public void testLoginUnverified() throws IOException { + long uniq = System.currentTimeMillis(); + String email = "system" + uniq + "@testmail.org"; + registerUser("an", "bn", email, TEST_PASSWORD); + waitForMail(); + assertFalse(isLoggedin(login(email, TEST_PASSWORD))); + } - public boolean isLoggedin(String cookie) throws IOException { - URL u = new URL("https://" + getServerName() + secureReference); - HttpURLConnection huc = (HttpURLConnection) u.openConnection(); - huc.addRequestProperty("Cookie", cookie); - return huc.getResponseCode() == 200; - } + @Test + public void testLoginVerified() throws IOException { + long uniq = System.currentTimeMillis(); + String email = "system2" + uniq + "@testmail.org"; + createVerifiedUser("an", "bn", email, TEST_PASSWORD); + assertTrue(isLoggedin(login(email, TEST_PASSWORD))); + } }