]> WPIA git - gigi.git/blob - tests/org/cacert/gigi/pages/wot/TestTTP.java
fix: ResultSet.getDate is often wrong as it fetches day-precision times
[gigi.git] / tests / org / cacert / gigi / pages / wot / TestTTP.java
1 package org.cacert.gigi.pages.wot;
2
3 import static org.hamcrest.CoreMatchers.*;
4 import static org.junit.Assert.*;
5
6 import java.io.IOException;
7
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;
15
16 public class TestTTP extends ClientTest {
17
18     public TestTTP() throws IOException {}
19
20     @Test
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"));
25
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));
31     }
32
33     @Test
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);
37
38         String ttp = IOUtils.readURL(get(RequestTTPPage.PATH));
39         assertThat(ttp, not(containsString("<form")));
40     }
41 }