Merge branch 'stable-2.15'

* stable-2.15:
  AgreementsIT: Test that anonymous user cannot sign agreement
  AgreementsIT: Test that signing agreement as other user fails

Change-Id: Ic91432ba352eb0cb10b394273a0509c152e6ae07
This commit is contained in:
David Pursehouse
2018-05-14 10:31:22 +09:00

View File

@@ -127,6 +127,23 @@ public class AgreementsIT extends AbstractDaemonTest {
assertThat(result).hasSize(1);
}
@Test
public void signAgreementAsOtherUser() throws Exception {
assume().that(isContributorAgreementsEnabled()).isTrue();
assertThat(gApi.accounts().self().get().name).isNotEqualTo("admin");
exception.expect(AuthException.class);
exception.expectMessage("not allowed to enter contributor agreement");
gApi.accounts().id("admin").signAgreement(caAutoVerify.getName());
}
@Test
public void signAgreementAnonymous() throws Exception {
setApiUserAnonymous();
exception.expect(AuthException.class);
exception.expectMessage("Authentication required");
gApi.accounts().self().signAgreement(caAutoVerify.getName());
}
@Test
public void agreementsDisabledSign() throws Exception {
assume().that(isContributorAgreementsEnabled()).isFalse();