]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/testUtils/ManagedTest.java
UPD: Allow all heade fields
[gigi.git] / tests / org / cacert / gigi / testUtils / ManagedTest.java
index ae62beb565b2e300b92e4a3f4df691b375c8a5bc..570d1636fab0b7775e3f74aa81c789023795aa7c 100644 (file)
@@ -45,10 +45,11 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.X509KeyManager;
 
 import org.cacert.gigi.DevelLauncher;
-import org.cacert.gigi.EmailAddress;
 import org.cacert.gigi.GigiApiException;
-import org.cacert.gigi.User;
 import org.cacert.gigi.database.DatabaseConnection;
+import org.cacert.gigi.dbObjects.EmailAddress;
+import org.cacert.gigi.dbObjects.ObjectCache;
+import org.cacert.gigi.dbObjects.User;
 import org.cacert.gigi.localisation.Language;
 import org.cacert.gigi.pages.account.MyDetails;
 import org.cacert.gigi.pages.main.RegisterPage;
@@ -67,6 +68,9 @@ import sun.security.x509.X500Name;
 
 public class ManagedTest {
 
+    static {
+        System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
+    }
     /**
      * Some password that fullfills the password criteria.
      */
@@ -171,6 +175,12 @@ public class ManagedTest {
             e.printStackTrace();
         }
         System.out.println(" in " + (System.currentTimeMillis() - ms) + " ms");
+        String type = testProps.getProperty("type");
+        ObjectCache.clearAllCaches();
+        if (type.equals("local")) {
+            URL u = new URL("https://" + getServerName() + "/manage");
+            u.openConnection().getHeaderField("Location");
+        }
     }
 
     private static Properties generateMainProps() {
@@ -506,10 +516,10 @@ public class ManagedTest {
     }
 
     public static EmailAddress createVerifiedEmail(User u) throws InterruptedException, GigiApiException {
-        EmailAddress adrr = new EmailAddress(createUniqueName() + "test@test.tld", u);
+        EmailAddress adrr = new EmailAddress(u, createUniqueName() + "test@test.tld");
         adrr.insert(Language.getInstance(Locale.ENGLISH));
         TestMail testMail = getMailReciever().recieve();
-        assertTrue(adrr.getAddress().equals(testMail.getTo()));
+        assertEquals(adrr.getAddress(), testMail.getTo());
         String hash = testMail.extractLink().substring(testMail.extractLink().lastIndexOf('=') + 1);
         adrr.verify(hash);
         getMailReciever().clearMails();