use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class PostLabelsIT method cannotSetCommitMessageOnLabelDefinitionInputForUpdate.
@Test
public void cannotSetCommitMessageOnLabelDefinitionInputForUpdate() throws Exception {
LabelDefinitionInput labelInput = new LabelDefinitionInput();
labelInput.commitMessage = "Update label";
BatchLabelInput input = new BatchLabelInput();
input.update = ImmutableMap.of(LabelId.CODE_REVIEW, labelInput);
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(allProjects.get()).labels(input));
assertThat(thrown).hasMessageThat().contains("commit message on label definition input not supported");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method functionIsTrimmed.
@Test
public void functionIsTrimmed() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.function = " " + LabelFunction.NO_OP.getFunctionName() + " ";
LabelDefinitionInfo updatedLabel = gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(updatedLabel.function).isEqualTo(LabelFunction.NO_OP.getFunctionName());
assertThat(gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get().function).isEqualTo(LabelFunction.NO_OP.getFunctionName());
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method setCopyMinScore.
@Test
public void setCopyMinScore() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyMinScore).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyMinScore = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyMinScore).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyMinScore).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method cannotSetEmptyValues.
@Test
public void cannotSetEmptyValues() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of();
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input));
assertThat(thrown).hasMessageThat().contains("values cannot be empty");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method defaultCommitMessage.
@Test
public void defaultCommitMessage() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.function = LabelFunction.NO_OP.getFunctionName();
gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(projectOperations.project(allProjects).getHead(RefNames.REFS_CONFIG).getShortMessage()).isEqualTo("Update label");
}
Aggregations