1 package org.cacert.gigi.pages.admin;
3 import static org.junit.Assert.*;
5 import java.io.IOException;
6 import java.io.OutputStream;
7 import java.io.UnsupportedEncodingException;
8 import java.net.MalformedURLException;
10 import java.net.URLConnection;
11 import java.net.URLEncoder;
13 import org.cacert.gigi.dbObjects.Group;
14 import org.cacert.gigi.pages.admin.support.FindUserPage;
15 import org.cacert.gigi.testUtils.ClientTest;
16 import org.junit.Test;
18 public class TestSEAdminPage extends ClientTest {
20 public TestSEAdminPage() throws IOException {
21 grant(email, Group.SUPPORTER);
25 public void testFulltextMailSearch() throws MalformedURLException, UnsupportedEncodingException, IOException {
26 String mail = createUniqueName() + "@example.com";
27 int id = createVerifiedUser("Först", "Secönd", mail, TEST_PASSWORD);
28 URLConnection uc = new URL("https://" + getServerName() + FindUserPage.PATH).openConnection();
29 uc.addRequestProperty("Cookie", cookie);
30 String csrf = getCSRF(uc, 0);
32 uc = new URL("https://" + getServerName() + FindUserPage.PATH).openConnection();
33 uc.addRequestProperty("Cookie", cookie);
35 OutputStream os = uc.getOutputStream();
36 os.write(("csrf=" + URLEncoder.encode(csrf, "UTF-8") + "&" //
37 + "process&email=" + URLEncoder.encode(mail, "UTF-8")).getBytes("UTF-8"));
39 assertEquals("https://" + getServerName() + "/support/user/" + id, uc.getHeaderField("Location"));