use of com.google.gerrit.extensions.common.LabelInfo in project gerrit by GerritCodeReview.
the class CustomLabelIT method customLabelMaxWithBlock_NegativeVoteBlock.
@Test
public void customLabelMaxWithBlock_NegativeVoteBlock() throws Exception {
saveLabelConfig();
PushOneCommit.Result r = createChange();
revision(r).review(new ReviewInput().label(label.getName(), -1));
ChangeInfo c = get(r.getChangeId());
LabelInfo q = c.labels.get(label.getName());
assertThat(q.all).hasSize(1);
assertThat(q.disliked).isNull();
assertThat(q.rejected).isNotNull();
assertThat(q.blocking).isTrue();
}
use of com.google.gerrit.extensions.common.LabelInfo in project gerrit by GerritCodeReview.
the class CustomLabelIT method customLabelMaxNoBlock_NegativeVoteNotBlock.
@Test
public void customLabelMaxNoBlock_NegativeVoteNotBlock() throws Exception {
label.setFunctionName("MaxNoBlock");
saveLabelConfig();
PushOneCommit.Result r = createChange();
revision(r).review(new ReviewInput().label(label.getName(), -1));
ChangeInfo c = get(r.getChangeId());
LabelInfo q = c.labels.get(label.getName());
assertThat(q.all).hasSize(1);
assertThat(q.rejected).isNotNull();
assertThat(q.blocking).isNull();
}
use of com.google.gerrit.extensions.common.LabelInfo in project gerrit by GerritCodeReview.
the class CustomLabelIT method customLabelNoBlock_NegativeVoteNotBlock.
@Test
public void customLabelNoBlock_NegativeVoteNotBlock() throws Exception {
label.setFunctionName("NoBlock");
saveLabelConfig();
PushOneCommit.Result r = createChange();
revision(r).review(new ReviewInput().label(label.getName(), -1));
ChangeInfo c = get(r.getChangeId());
LabelInfo q = c.labels.get(label.getName());
assertThat(q.all).hasSize(1);
assertThat(q.rejected).isNotNull();
assertThat(q.blocking).isNull();
}
use of com.google.gerrit.extensions.common.LabelInfo in project gerrit by GerritCodeReview.
the class CustomLabelIT method customLabelAnyWithBlock_NegativeVoteBlock.
@Test
public void customLabelAnyWithBlock_NegativeVoteBlock() throws Exception {
label.setFunctionName("AnyWithBlock");
saveLabelConfig();
PushOneCommit.Result r = createChange();
revision(r).review(new ReviewInput().label(label.getName(), -1));
ChangeInfo c = get(r.getChangeId());
LabelInfo q = c.labels.get(label.getName());
assertThat(q.all).hasSize(1);
assertThat(q.disliked).isNull();
assertThat(q.rejected).isNotNull();
assertThat(q.blocking).isTrue();
}
use of com.google.gerrit.extensions.common.LabelInfo in project gerrit by GerritCodeReview.
the class ChangeIT method maxPermittedValueAllowed.
@Test
public void maxPermittedValueAllowed() throws Exception {
final int minPermittedValue = -2;
final int maxPermittedValue = +2;
String heads = "refs/heads/*";
PushOneCommit.Result r = createChange();
String triplet = project.get() + "~master~" + r.getChangeId();
gApi.changes().id(triplet).addReviewer(user.username);
ChangeInfo c = gApi.changes().id(triplet).get(EnumSet.of(ListChangesOption.DETAILED_LABELS));
LabelInfo codeReview = c.labels.get("Code-Review");
assertThat(codeReview.all).hasSize(1);
ApprovalInfo approval = codeReview.all.get(0);
assertThat(approval._accountId).isEqualTo(user.id.get());
assertThat(approval.permittedVotingRange).isNotNull();
// default values
assertThat(approval.permittedVotingRange.min).isEqualTo(-1);
assertThat(approval.permittedVotingRange.max).isEqualTo(1);
ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
Util.allow(cfg, Permission.forLabel("Code-Review"), minPermittedValue, maxPermittedValue, REGISTERED_USERS, heads);
saveProjectConfig(project, cfg);
c = gApi.changes().id(triplet).get(EnumSet.of(ListChangesOption.DETAILED_LABELS));
codeReview = c.labels.get("Code-Review");
assertThat(codeReview.all).hasSize(1);
approval = codeReview.all.get(0);
assertThat(approval._accountId).isEqualTo(user.id.get());
assertThat(approval.permittedVotingRange).isNotNull();
assertThat(approval.permittedVotingRange.min).isEqualTo(minPermittedValue);
assertThat(approval.permittedVotingRange.max).isEqualTo(maxPermittedValue);
}
Aggregations