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;
private static String url = "localhost:4443";
+ private static String acceptLanguage = null;
+
+ public static void setAcceptLanguage(String acceptLanguage) {
+ ManagedTest.acceptLanguage = acceptLanguage;
+ }
+
public static String getServerName() {
return url;
}
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() {
ter.reset();
}
+ @After
+ public void clearAcceptLanguage() {
+ acceptLanguage = null;
+ }
+
public TestMail waitForMail() {
try {
return ter.recieve();
URL regist = new URL("https://" + getServerName() + RegisterPage.PATH);
HttpURLConnection uc = (HttpURLConnection) regist.openConnection();
HttpURLConnection csrfConn = (HttpURLConnection) regist.openConnection();
+ if (acceptLanguage != null) {
+ csrfConn.setRequestProperty("Accept-Language", acceptLanguage);
+ uc.setRequestProperty("Accept-Language", acceptLanguage);
+ }
String headerField = csrfConn.getHeaderField("Set-Cookie");
headerField = stripCookie(headerField);
}
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();