X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FLoginTest.java;h=3097062365111722586fc401c94dbc8926ec7343;hb=6d1b746247f6e1eab7d1da17112beb9cf5abb089;hp=d6c6fc4941910fc1828d29cbc17abd70e67147f9;hpb=ec24cf6925bb3729a644580ad4a9375d05883c62;p=gigi.git diff --git a/tests/org/cacert/gigi/LoginTest.java b/tests/org/cacert/gigi/LoginTest.java index d6c6fc49..30970623 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(); + getMailReceiver().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")); } }