1 package org.cacert.gigi.pages.wot;
3 import static org.hamcrest.CoreMatchers.*;
4 import static org.junit.Assert.*;
6 import java.io.IOException;
8 import org.cacert.gigi.GigiApiException;
9 import org.cacert.gigi.dbObjects.Group;
10 import org.cacert.gigi.dbObjects.ObjectCache;
11 import org.cacert.gigi.dbObjects.User;
12 import org.cacert.gigi.testUtils.ClientTest;
13 import org.cacert.gigi.testUtils.IOUtils;
14 import org.junit.Test;
16 public class TestTTP extends ClientTest {
18 public TestTTP() throws IOException {}
21 public void testTTPApply() throws IOException {
22 String ttp = IOUtils.readURL(get(RequestTTPPage.PATH));
23 assertThat(ttp, containsString("<form"));
24 assertNull(executeBasicWebInteraction(cookie, RequestTTPPage.PATH, "country=0"));
26 ttp = IOUtils.readURL(get(RequestTTPPage.PATH));
27 assertThat(ttp, not(containsString("<form")));
28 ObjectCache.clearAllCaches();
29 u = User.getById(u.getId());
30 assertTrue(u.isInGroup(Group.TTP_APPLICANT));
34 public void testTTPEnoughPoints() throws IOException, GigiApiException {
35 User u = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
36 cookie = login(u.getEmail(), TEST_PASSWORD);
38 String ttp = IOUtils.readURL(get(RequestTTPPage.PATH));
39 assertThat(ttp, not(containsString("<form")));