use of com.google.gerrit.extensions.restapi.MethodNotAllowedException in project gerrit by GerritCodeReview.
the class DeleteBranchIT method cannotDeleteRefsMetaConfig.
@Test
public void cannotDeleteRefsMetaConfig() throws Exception {
MethodNotAllowedException thrown = assertThrows(MethodNotAllowedException.class, () -> branch(BranchNameKey.create(allUsers, RefNames.REFS_CONFIG)).delete());
assertThat(thrown).hasMessageThat().contains("not allowed to delete branch refs/meta/config");
}
use of com.google.gerrit.extensions.restapi.MethodNotAllowedException in project gerrit by GerritCodeReview.
the class DeleteBranchIT method cannotDeleteHead.
@Test
public void cannotDeleteHead() throws Exception {
MethodNotAllowedException thrown = assertThrows(MethodNotAllowedException.class, () -> branch(BranchNameKey.create(allUsers, RefNames.HEAD)).delete());
assertThat(thrown).hasMessageThat().contains("not allowed to delete HEAD");
}
use of com.google.gerrit.extensions.restapi.MethodNotAllowedException in project gerrit by GerritCodeReview.
the class DeleteBranchesIT method cannotDeleteRefsMetaConfig.
@Test
public void cannotDeleteRefsMetaConfig() throws Exception {
DeleteBranchesInput input = new DeleteBranchesInput();
input.branches = Lists.newArrayList();
input.branches.add(RefNames.REFS_CONFIG);
MethodNotAllowedException thrown = assertThrows(MethodNotAllowedException.class, () -> project().deleteBranches(input));
assertThat(thrown).hasMessageThat().contains("not allowed to delete branch refs/meta/config");
}
use of com.google.gerrit.extensions.restapi.MethodNotAllowedException in project gerrit by GerritCodeReview.
the class DeleteBranchesIT method cannotDeleteHead.
@Test
public void cannotDeleteHead() throws Exception {
DeleteBranchesInput input = new DeleteBranchesInput();
input.branches = Lists.newArrayList();
input.branches.add(RefNames.HEAD);
MethodNotAllowedException thrown = assertThrows(MethodNotAllowedException.class, () -> project().deleteBranches(input));
assertThat(thrown).hasMessageThat().contains("not allowed to delete HEAD");
}
use of com.google.gerrit.extensions.restapi.MethodNotAllowedException in project gerrit by GerritCodeReview.
the class PrivateByDefaultIT method createChangeWithPrivateByDefaultAndDisablePrivateChangesTrue.
@Test
@GerritConfig(name = "change.disablePrivateChanges", value = "true")
public void createChangeWithPrivateByDefaultAndDisablePrivateChangesTrue() throws Exception {
setPrivateByDefault(project2, InheritableBoolean.TRUE);
ChangeInput input = new ChangeInput(project2.get(), "master", "empty change");
MethodNotAllowedException thrown = assertThrows(MethodNotAllowedException.class, () -> gApi.changes().create(input));
assertThat(thrown).hasMessageThat().contains("private changes are disabled");
}
Aggregations