Merge branch 'stable-2.14' into stable-2.15

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

Change-Id: I997621d1ee03e1f10eb396d76451ac1ca5e04b89
This commit is contained in:
David Pursehouse 2018-05-14 10:16:19 +09:00
commit 276ca53c2a

View File

@ -128,6 +128,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();