X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FLoginTest.java;h=cb575caf78190d3fb97bf33e0326beb242af57b6;hp=d6c6fc4941910fc1828d29cbc17abd70e67147f9;hb=d7be034f96e06985f57d86d2779c434276b5bd4d;hpb=e87392fd58e9152531a8d1cb34cb46e370062108 diff --git a/tests/org/cacert/gigi/LoginTest.java b/tests/org/cacert/gigi/LoginTest.java index d6c6fc49..cb575caf 100644 --- a/tests/org/cacert/gigi/LoginTest.java +++ b/tests/org/cacert/gigi/LoginTest.java @@ -1,10 +1,12 @@ package org.cacert.gigi; +import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import java.io.IOException; -import java.net.URL; +import java.net.URLConnection; +import org.cacert.gigi.testUtils.IOUtils; import org.cacert.gigi.testUtils.ManagedTest; import org.junit.Test; @@ -14,7 +16,7 @@ public class LoginTest extends ManagedTest { public void testLoginUnverified() throws IOException { String email = createUniqueName() + "@testmail.org"; registerUser("an", "bn", email, TEST_PASSWORD); - waitForMail(); + getMailReciever().receive(); assertFalse(isLoggedin(login(email, TEST_PASSWORD))); } @@ -43,7 +45,17 @@ public class LoginTest extends ManagedTest { } private void logout(String cookie) throws IOException { - cookie(new URL("https://" + getServerName() + "/logout").openConnection(), cookie).getHeaderField("Location"); + get(cookie, "/logout").getHeaderField("Location"); + } + + @Test + public void testLoginMethodDisplay() throws IOException { + String email = createUniqueName() + "@testmail.org"; + createVerifiedUser("an", "bn", email, TEST_PASSWORD); + String l = login(email, TEST_PASSWORD); + URLConnection c = get(l, ""); + String readURL = IOUtils.readURL(c); + assertThat(readURL, containsString("Password")); } }