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.Group;
import club.wpia.gigi.dbObjects.ObjectCache;
import club.wpia.gigi.dbObjects.User;
import club.wpia.gigi.pages.account.History;
import club.wpia.gigi.pages.admin.support.SupportEnterTicketPage;
import club.wpia.gigi.pages.admin.support.SupportUserDetailsPage;
-import club.wpia.gigi.testUtils.ClientTest;
import club.wpia.gigi.testUtils.IOUtils;
+import club.wpia.gigi.testUtils.SEClientTest;
import club.wpia.gigi.util.DayDate;
-public class TestSEAdminPageDetails extends ClientTest {
+public class TestSEAdminPageDetails extends SEClientTest {
+
+ private Certificate cs;
public TestSEAdminPageDetails() throws IOException, GigiApiException {
- grant(u, Group.SUPPORTER);
- cookie = login(email, TEST_PASSWORD);
- assertEquals(302, post(cookie, SupportEnterTicketPage.PATH, "ticketno=a20140808.8&setTicket=action", 0).getResponseCode());
+ cs = loginCertificate;
}
@Test
int id = createVerifiedUser(fname, lname, email, TEST_PASSWORD);
String email2 = createUniqueName() + "@example.com";
EmailAddress ea = new EmailAddress(User.getById(id), email2, Locale.ENGLISH);
- getMailReceiver().receive().verify();
+ getMailReceiver().receive(email2).verify();
// Refresh email Object
ObjectCache.clearAllCaches();
ea = EmailAddress.getById(ea.getId());
assertEquals(3, logCountAdmin(id));
assertEquals(3, logCountUser(clientCookie));
+ // discarding all 6 mails
+ for (int i = 0; i < 6; i++) {
+ getMailReceiver().receive(null);
+ }
}
@Test
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
-
- makeAssurer(this.id);
+ loginCertificate = cs;
+ makeAgent(this.id);
String location = createUniqueName();
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `when`=? ")) {
ps.setInt(1, this.id);
}
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) {