use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithoutCopyAllScoresOnMergeFirstParentUpdate.
@Test
public void createWithoutCopyAllScoresOnMergeFirstParentUpdate() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyAllScoresOnMergeFirstParentUpdate = false;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyAllScoresOnMergeFirstParentUpdate).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method cannotCreateLabelWithNameThatIsAlreadyInUse.
@Test
public void cannotCreateLabelWithNameThatIsAlreadyInUse() throws Exception {
ResourceConflictException thrown = assertThrows(ResourceConflictException.class, () -> gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).create(new LabelDefinitionInput()));
assertThat(thrown).hasMessageThat().contains("label Code-Review already exists");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithCopyMinScore.
@Test
public void createWithCopyMinScore() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyMinScore = true;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyMinScore).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method notAllowed.
@Test
public void notAllowed() throws Exception {
projectOperations.project(project).forUpdate().add(allow(Permission.READ).ref(RefNames.REFS_CONFIG).group(REGISTERED_USERS)).update();
requestScopeOperations.setApiUser(user.id());
AuthException thrown = assertThrows(AuthException.class, () -> gApi.projects().name(project.get()).label("Foo-Review").create(new LabelDefinitionInput()));
assertThat(thrown).hasMessageThat().contains("write refs/meta/config not permitted");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class CreateLabelIT method createWithoutCopyMaxScore.
@Test
public void createWithoutCopyMaxScore() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
input.copyMaxScore = false;
LabelDefinitionInfo createdLabel = gApi.projects().name(project.get()).label("foo").create(input).get();
assertThat(createdLabel.copyMaxScore).isNull();
}
Aggregations