import java.io.IOException;
import java.net.MalformedURLException;
+import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.Group;
import org.cacert.gigi.pages.admin.support.SupportEnterTicketPage;
import org.cacert.gigi.pages.admin.support.SupportUserDetailsPage;
private int targetID;
- public TestSEAdminNotificationMail() throws IOException {
- grant(email, Group.SUPPORTER);
+ public TestSEAdminNotificationMail() 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());
String email = createUniqueName() + "@example.com";
@Test
public void testChangeAccountData() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "dobd=1&dobm=2&doby=2000&detailupdate", 0);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "dobd=1&dobm=2&doby=2000&detailupdate", 0);
String message = getMailReceiver().receive().getMessage();
assertThat(message, containsString("The account data was changed."));
@Test
public void testPasswordReset() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "aword=SecretWord&resetPass", 0);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "aword=SecretWord&resetPass", 0);
TestMail tm;
- String targetMail = "support@" + ServerConstants.getWwwHostName().replaceFirst("^www\\.", "");
+ String targetMail = ServerConstants.getSupportMailAddress();
do {
tm = getMailReceiver().receive();
} while ( !tm.getTo().equals(targetMail));
@Test
public void testGrantUserGroup() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "grant&groupToModify=supporter", 0);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "addGroup&groupToModify=supporter", 0);
String message = getMailReceiver().receive().getMessage();
assertThat(message, containsString("The group permission supporter was granted."));
@Test
public void testRemoveUserGroup() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "deny&groupToModify=supporter", 0);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "removeGroup&groupToModify=supporter", 0);
String message = getMailReceiver().receive().getMessage();
assertThat(message, containsString("The group permission supporter was revoked."));
@Test
public void testRevokeCertificates() throws MalformedURLException, IOException {
- executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID, "revokeall", 1);
+ executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + targetID + "/", "revokeall", 1);
String message = getMailReceiver().receive().getMessage();
assertThat(message, containsString("All certificates in the account have been revoked."));