import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLEncoder;
-import org.cacert.gigi.User;
-import org.cacert.gigi.localisation.Language;
-import org.cacert.gigi.testUtils.ManagedTest;
+import org.cacert.gigi.dbObjects.EmailAddress;
+import org.cacert.gigi.dbObjects.ObjectCache;
+import org.cacert.gigi.dbObjects.User;
+import org.cacert.gigi.pages.account.mail.MailOverview;
+import org.cacert.gigi.testUtils.ClientTest;
-public class TestMailManagement extends ManagedTest {
-
- private User u = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "uni@example.org", TEST_PASSWORD));
-
- private String cookie;
+public class TestMailManagement extends ClientTest {
public void testMailSetDefaultWeb() throws MalformedURLException, UnsupportedEncodingException, IOException, InterruptedException, GigiApiException {
EmailAddress adrr = createVerifiedEmail(u);
assertNull(executeBasicWebInteraction(cookie, path, "makedefault&emailid=" + adrr.getId()));
public void testMailSetDefaultWeb() throws MalformedURLException, UnsupportedEncodingException, IOException, InterruptedException, GigiApiException {
EmailAddress adrr = createVerifiedEmail(u);
assertNull(executeBasicWebInteraction(cookie, path, "makedefault&emailid=" + adrr.getId()));
assertEquals(User.getById(u.getId()).getEmail(), adrr.getAddress());
}
@Test
public void testMailSetDefaultWebUnverified() throws MalformedURLException, UnsupportedEncodingException, IOException, InterruptedException, GigiApiException {
assertEquals(User.getById(u.getId()).getEmail(), adrr.getAddress());
}
@Test
public void testMailSetDefaultWebUnverified() throws MalformedURLException, UnsupportedEncodingException, IOException, InterruptedException, GigiApiException {
- EmailAddress adrr = new EmailAddress(createUniqueName() + "test@test.tld", u);
- adrr.insert(Language.getInstance("en"));
+ EmailAddress adrr = new EmailAddress(u, createUniqueName() + "test@test.tld", Locale.ENGLISH);
assertNotNull(executeBasicWebInteraction(cookie, path, "makedefault&emailid=" + adrr.getId()));
assertNotEquals(User.getById(u.getId()).getEmail(), adrr.getAddress());
getMailReciever().clearMails();
assertNotNull(executeBasicWebInteraction(cookie, path, "makedefault&emailid=" + adrr.getId()));
assertNotEquals(User.getById(u.getId()).getEmail(), adrr.getAddress());
getMailReciever().clearMails();
u2 = User.getById(u2.getId());
assertNotEquals(u2.getEmails().length, 0);
}
u2 = User.getById(u2.getId());
assertNotEquals(u2.getEmails().length, 0);
}
+
+ @Test
+ public void testMailDeleteWebPrimary() throws MalformedURLException, UnsupportedEncodingException, IOException {
+ assertNotNull(executeBasicWebInteraction(cookie, path, "delete&delid[]=" + u.getEmails()[0].getId(), 0));
+ assertNotEquals(u.getEmails().length, 0);
+ }