use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method branchesCanBeUnset.
@Test
public void branchesCanBeUnset() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.branches = ImmutableList.of("refs/heads/master");
gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get().branches).isNotNull();
input.branches = ImmutableList.of();
LabelDefinitionInfo updatedLabel = gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(updatedLabel.branches).isNull();
assertThat(gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get().branches).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method setCopyAllScoresIfListOfFilesDidNotChange.
@Test
public void setCopyAllScoresIfListOfFilesDidNotChange() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresIfListOfFilesDidNotChange).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAllScoresIfListOfFilesDidNotChange = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAllScoresIfListOfFilesDidNotChange).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresIfListOfFilesDidNotChange).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method setIgnoreSelfApproval.
@Test
public void setIgnoreSelfApproval() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().ignoreSelfApproval).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.ignoreSelfApproval = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.ignoreSelfApproval).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().ignoreSelfApproval).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method cannotSetUnknownFunction.
@Test
public void cannotSetUnknownFunction() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.function = "UnknownFunction";
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input));
assertThat(thrown).hasMessageThat().contains("unknown function: " + input.function);
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method unsetAllowPostSubmit.
@Test
public void unsetAllowPostSubmit() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().allowPostSubmit).isTrue();
LabelDefinitionInput input = new LabelDefinitionInput();
input.allowPostSubmit = false;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.allowPostSubmit).isNull();
assertThat(gApi.projects().name(project.get()).label("foo").get().allowPostSubmit).isNull();
}
Aggregations