X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fpages%2Faccount%2FTestMailManagement.java;h=6659a1e115cbacb5467aca7c3cbe8e75267ee8b0;hp=6b213b45c4026051cc9ead129df1f14f1617023f;hb=8af6231b22da4fef795bcb54913faad6592b1a02;hpb=e409ba881965634f63f0b67824bc93dda4ec4327 diff --git a/tests/org/cacert/gigi/pages/account/TestMailManagement.java b/tests/org/cacert/gigi/pages/account/TestMailManagement.java index 6b213b45..6659a1e1 100644 --- a/tests/org/cacert/gigi/pages/account/TestMailManagement.java +++ b/tests/org/cacert/gigi/pages/account/TestMailManagement.java @@ -10,16 +10,14 @@ import java.util.Locale; import org.cacert.gigi.GigiApiException; 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.testUtils.ManagedTest; +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; @@ -36,7 +34,7 @@ public class TestMailManagement extends ManagedTest { @Test public void testMailAddInternalFaulty() { try { - new EmailAddress("kurti ", u); + new EmailAddress(u, "kurti "); fail(); } catch (IllegalArgumentException e) { // Intended. @@ -72,12 +70,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); + EmailAddress adrr = new EmailAddress(u, createUniqueName() + "test@test.tld"); adrr.insert(Language.getInstance(Locale.ENGLISH)); assertNotNull(executeBasicWebInteraction(cookie, path, "makedefault&emailid=" + adrr.getId())); assertNotEquals(User.getById(u.getId()).getEmail(), adrr.getAddress()); @@ -133,4 +132,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); + } }