X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fpages%2Faccount%2FTestMailManagement.java;h=412e2d78a1e98da97839fbd081b659b3777d50a2;hp=3d813ec981d857aa1728de40b6ea9bdaf8a5c8b2;hb=a8422ae5d5dc70c5a2776d3cead356c111e5b9d7;hpb=795b21c53624fde4520e6cda1fb18a76635cd2a3 diff --git a/tests/org/cacert/gigi/pages/account/TestMailManagement.java b/tests/org/cacert/gigi/pages/account/TestMailManagement.java index 3d813ec9..412e2d78 100644 --- a/tests/org/cacert/gigi/pages/account/TestMailManagement.java +++ b/tests/org/cacert/gigi/pages/account/TestMailManagement.java @@ -12,16 +12,11 @@ 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.pages.account.mail.MailOverview; -import org.cacert.gigi.testUtils.ManagedTest; +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,9 +31,9 @@ public class TestMailManagement extends ManagedTest { } @Test - public void testMailAddInternalFaulty() { + public void testMailAddInternalFaulty() throws GigiApiException { try { - new EmailAddress(u, "kurti "); + new EmailAddress(u, "kurti ", Locale.ENGLISH); fail(); } catch (IllegalArgumentException e) { // Intended. @@ -72,18 +67,17 @@ public class TestMailManagement extends ManagedTest { @Test public void testMailSetDefaultWeb() throws MalformedURLException, UnsupportedEncodingException, IOException, InterruptedException, GigiApiException { - EmailAddress adrr = createVerifiedEmail(u); - assertNull(executeBasicWebInteraction(cookie, path, "makedefault&emailid=" + adrr.getId())); + EmailAddress addr = createVerifiedEmail(u); + assertNull(executeBasicWebInteraction(cookie, path, "default:" + addr.getId())); ObjectCache.clearAllCaches(); - assertEquals(User.getById(u.getId()).getEmail(), adrr.getAddress()); + assertEquals(User.getById(u.getId()).getEmail(), addr.getAddress()); } @Test public void testMailSetDefaultWebUnverified() throws MalformedURLException, UnsupportedEncodingException, IOException, InterruptedException, GigiApiException { - 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()); + EmailAddress addr = new EmailAddress(u, createUniqueName() + "test@test.tld", Locale.ENGLISH); + assertNotNull(executeBasicWebInteraction(cookie, path, "default:" + addr.getId())); + assertNotEquals(User.getById(u.getId()).getEmail(), addr.getAddress()); getMailReciever().clearMails(); } @@ -98,7 +92,7 @@ public class TestMailManagement extends ManagedTest { } } assertNotEquals(id, -1); - assertNotNull(executeBasicWebInteraction(cookie, path, "makedefault&emailid=" + id)); + assertNotNull(executeBasicWebInteraction(cookie, path, "default:" + id)); assertNotEquals(User.getById(u.getId()).getEmail(), u2.getEmail()); getMailReciever().clearMails(); } @@ -106,7 +100,7 @@ public class TestMailManagement extends ManagedTest { @Test public void testMailDeleteWeb() throws InterruptedException, GigiApiException, MalformedURLException, UnsupportedEncodingException, IOException { EmailAddress addr = createVerifiedEmail(u); - assertNull(executeBasicWebInteraction(cookie, path, "delete&delid[]=" + addr.getId(), 0)); + assertNull(executeBasicWebInteraction(cookie, path, "delete:" + addr.getId(), 0)); User u = User.getById(this.u.getId()); EmailAddress[] addresses = u.getEmails(); for (int i = 0; i < addresses.length; i++) { @@ -119,7 +113,7 @@ public class TestMailManagement extends ManagedTest { EmailAddress[] addr = new EmailAddress[] { createVerifiedEmail(u), createVerifiedEmail(u) }; - assertNull(executeBasicWebInteraction(cookie, path, "delete&delid[]=" + addr[0].getId() + "&delid[]=" + addr[1].getId(), 0)); + assertNull(executeBasicWebInteraction(cookie, path, "delete:" + addr[0].getId() + "&delete:" + addr[1].getId(), 0)); User u = User.getById(this.u.getId()); EmailAddress[] addresses = u.getEmails(); for (int i = 0; i < addresses.length; i++) { @@ -132,14 +126,14 @@ public class TestMailManagement extends ManagedTest { public void testMailDeleteWebFaulty() throws MalformedURLException, UnsupportedEncodingException, IOException { User u2 = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "uni@test.tld", TEST_PASSWORD)); EmailAddress em = u2.getEmails()[0]; - assertNotNull(executeBasicWebInteraction(cookie, path, "delete&delid[]=" + em.getId(), 0)); + assertNotNull(executeBasicWebInteraction(cookie, path, "delete:" + em.getId(), 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)); + assertNotNull(executeBasicWebInteraction(cookie, path, "delete:" + u.getEmails()[0].getId(), 0)); assertNotEquals(u.getEmails().length, 0); } }