]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/LoginTest.java
Reinforce Signup tests.
[gigi.git] / tests / org / cacert / gigi / LoginTest.java
index 729a5988e8053f4f4cf4e3b26828acec9b801a63..e8353accdc2d724052c857ec4ae2385fb050d202 100644 (file)
@@ -2,38 +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);
+               registerUser("an", "bn", email, TEST_PASSWORD);
                waitForMail();
-               assertFalse(isLoggedin(login(email, pw)));
+               assertFalse(isLoggedin(login(email, TEST_PASSWORD)));
        }
+
        @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)));
-       }
-       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;
+               createVerifiedUser("an", "bn", email, TEST_PASSWORD);
+               assertTrue(isLoggedin(login(email, TEST_PASSWORD)));
        }
 
 }