import club.wpia.gigi.GigiApiException;
import club.wpia.gigi.database.GigiPreparedStatement;
+import club.wpia.gigi.dbObjects.Certificate;
import club.wpia.gigi.dbObjects.EmailAddress;
import club.wpia.gigi.dbObjects.ObjectCache;
import club.wpia.gigi.dbObjects.User;
public class TestSEAdminPageDetails extends SEClientTest {
- public TestSEAdminPageDetails() throws IOException, GigiApiException {}
+ private Certificate cs;
+
+ public TestSEAdminPageDetails() throws IOException, GigiApiException {
+ cs = loginCertificate;
+ }
@Test
public void testUserDetailsDisplay() throws MalformedURLException, IOException {
String clientCookie = login(email, TEST_PASSWORD);
// try to open mypoints as user
+ loginCertificate = null;
HttpURLConnection uc = get(clientCookie, SupportUserDetailsPage.PATH + id + "/points");
assertEquals(403, uc.getResponseCode());
// enter verification and open mypoints as supporter
-
+ loginCertificate = cs;
makeAgent(this.id);
String location = createUniqueName();
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `when`=? ")) {
}
private int logCountUser(String cookie) throws IOException {
- return getLogEntryCount(IOUtils.readURL(get(cookie, History.PATH)));
+ loginCertificate = null;
+ int count = getLogEntryCount(IOUtils.readURL(get(cookie, History.PATH)));
+ loginCertificate = cs;
+ return count;
}
private int getLogEntryCount(String readURL) {
return c;
}
+ @Test
+ public void testUserDetailsRAAgent() throws IOException, GigiApiException {
+ User u0 = User.getById(createVerifiedUser("Kurti", "Hansel", createUniqueName() + "@email.com", TEST_PASSWORD));
+
+ HttpURLConnection uc = get(cookie, SupportUserDetailsPage.PATH + u0.getId() + "/");
+ String res = IOUtils.readURL(uc);
+ assertThat(res, containsString("No (RA Agent Contract signed: No)"));
+
+ signRAContract(u0);
+ uc = get(cookie, SupportUserDetailsPage.PATH + u0.getId() + "/");
+ res = IOUtils.readURL(uc);
+ assertThat(res, containsString("No (RA Agent Contract signed: Yes)"));
+
+ insertPassedTest(u0.getId());
+ uc = get(cookie, SupportUserDetailsPage.PATH + u0.getId() + "/");
+ res = IOUtils.readURL(uc);
+ assertThat(res, containsString("No (RA Agent Contract signed: Yes)"));
+
+ insertVerificationPoints(u0.getId());
+ uc = get(cookie, SupportUserDetailsPage.PATH + u0.getId() + "/");
+ res = IOUtils.readURL(uc);
+ assertThat(res, not(containsString("RA Agent Contract signed:")));
+
+ }
}