X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fpages%2Faccount%2FTestMailManagement.java;h=bf97c26964c5c7a697d8fd6309eb973757f313d2;hb=dc10b875c132eb7840a6b9827ec93916076d34f7;hp=09bd98cee5c838976468bfd508531d1cfa037bcb;hpb=480cb29387c76ccc19f8fa8fb0abe8ae1b069730;p=gigi.git diff --git a/tests/org/cacert/gigi/pages/account/TestMailManagement.java b/tests/org/cacert/gigi/pages/account/TestMailManagement.java index 09bd98ce..bf97c269 100644 --- a/tests/org/cacert/gigi/pages/account/TestMailManagement.java +++ b/tests/org/cacert/gigi/pages/account/TestMailManagement.java @@ -6,19 +6,17 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URLEncoder; +import java.util.Locale; -import org.cacert.gigi.EmailAddress; import org.cacert.gigi.GigiApiException; -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; import org.junit.Test; -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 { private String path = MailOverview.DEFAULT_PATH; @@ -33,9 +31,9 @@ public class TestMailManagement extends ManagedTest { } @Test - public void testMailAddInternalFaulty() { + public void testMailAddInternalFaulty() throws GigiApiException { try { - new EmailAddress("kurti ", u); + new EmailAddress(u, "kurti ", Locale.ENGLISH); fail(); } catch (IllegalArgumentException e) { // Intended. @@ -71,13 +69,13 @@ public class TestMailManagement extends ManagedTest { public void testMailSetDefaultWeb() throws MalformedURLException, UnsupportedEncodingException, IOException, InterruptedException, GigiApiException { EmailAddress adrr = createVerifiedEmail(u); assertNull(executeBasicWebInteraction(cookie, path, "makedefault&emailid=" + adrr.getId())); + ObjectCache.clearAllCaches(); 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(); @@ -132,4 +130,10 @@ public class TestMailManagement extends ManagedTest { 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); + } }