use of com.google.gerrit.extensions.api.projects.DeleteBranchesInput in project gerrit by GerritCodeReview.
the class DeleteBranchesIT method deleteBranchesForbidden.
@Test
public void deleteBranchesForbidden() throws Exception {
DeleteBranchesInput input = new DeleteBranchesInput();
input.branches = BRANCHES;
setApiUser(user);
try {
project().deleteBranches(input);
fail("Expected ResourceConflictException");
} catch (ResourceConflictException e) {
assertThat(e).hasMessageThat().isEqualTo(errorMessageForBranches(BRANCHES));
}
setApiUser(admin);
assertBranches(BRANCHES);
}
use of com.google.gerrit.extensions.api.projects.DeleteBranchesInput in project gerrit by GerritCodeReview.
the class DeleteBranchesIT method deleteBranchesNotFound.
@Test
public void deleteBranchesNotFound() throws Exception {
DeleteBranchesInput input = new DeleteBranchesInput();
List<String> branches = Lists.newArrayList(BRANCHES);
branches.add("refs/heads/does-not-exist");
input.branches = branches;
try {
project().deleteBranches(input);
fail("Expected ResourceConflictException");
} catch (ResourceConflictException e) {
assertThat(e).hasMessageThat().isEqualTo(errorMessageForBranches(ImmutableList.of("refs/heads/does-not-exist")));
}
assertBranchesDeleted();
}
use of com.google.gerrit.extensions.api.projects.DeleteBranchesInput in project gerrit by GerritCodeReview.
the class DeleteBranchesIT method emptyBranchList.
@Test
public void emptyBranchList() throws Exception {
DeleteBranchesInput input = new DeleteBranchesInput();
input.branches = Lists.newArrayList();
exception.expect(BadRequestException.class);
exception.expectMessage("branches must be specified");
project().deleteBranches(input);
}
use of com.google.gerrit.extensions.api.projects.DeleteBranchesInput in project gerrit by GerritCodeReview.
the class DeleteBranchesIT method deleteBranchesNotFoundContinue.
@Test
public void deleteBranchesNotFoundContinue() throws Exception {
// If it fails on the first branch in the input, it should still
// continue to process the remaining branches.
DeleteBranchesInput input = new DeleteBranchesInput();
List<String> branches = Lists.newArrayList("refs/heads/does-not-exist");
branches.addAll(BRANCHES);
input.branches = branches;
try {
project().deleteBranches(input);
fail("Expected ResourceConflictException");
} catch (ResourceConflictException e) {
assertThat(e).hasMessageThat().isEqualTo(errorMessageForBranches(ImmutableList.of("refs/heads/does-not-exist")));
}
assertBranchesDeleted();
}
use of com.google.gerrit.extensions.api.projects.DeleteBranchesInput in project gerrit by GerritCodeReview.
the class DeleteBranchesIT method missingBranchList.
@Test
public void missingBranchList() throws Exception {
DeleteBranchesInput input = new DeleteBranchesInput();
exception.expect(BadRequestException.class);
exception.expectMessage("branches must be specified");
project().deleteBranches(input);
}
Aggregations