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