Test that removed votes are not sticky
Change-Id: I1fa5e969c8000dc84f39e91cdf8e4f7d1e2e5823 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
committed by
David Pursehouse
parent
1fd4c52c5a
commit
46cdd95661
@@ -217,6 +217,36 @@ public class StickyApprovalsIT extends AbstractDaemonTest {
|
|||||||
assertNotSticky(EnumSet.of(REWORK, NO_CODE_CHANGE, TRIVIAL_REBASE));
|
assertNotSticky(EnumSet.of(REWORK, NO_CODE_CHANGE, TRIVIAL_REBASE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void removedVotesNotSticky() throws Exception {
|
||||||
|
ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
|
||||||
|
cfg.getLabelSections().get("Code-Review")
|
||||||
|
.setCopyAllScoresOnTrivialRebase(true);
|
||||||
|
cfg.getLabelSections().get("Verified").setCopyAllScoresIfNoCodeChange(true);
|
||||||
|
saveProjectConfig(project, cfg);
|
||||||
|
|
||||||
|
for (ChangeKind changeKind : EnumSet.of(REWORK, TRIVIAL_REBASE,
|
||||||
|
NO_CODE_CHANGE, MERGE_FIRST_PARENT_UPDATE)) {
|
||||||
|
testRepo.reset(getRemoteHead());
|
||||||
|
|
||||||
|
String changeId = createChange(changeKind);
|
||||||
|
vote(admin, changeId, 2, 1);
|
||||||
|
vote(user, changeId, -2, -1);
|
||||||
|
|
||||||
|
// Remove votes by re-voting with 0
|
||||||
|
vote(admin, changeId, 0, 0);
|
||||||
|
vote(user, changeId, 0, 0);
|
||||||
|
ChangeInfo c = detailedChange(changeId);
|
||||||
|
assertVotes(c, admin, 0, 0, null);
|
||||||
|
assertVotes(c, user, 0, 0, null);
|
||||||
|
|
||||||
|
updateChange(changeId, changeKind);
|
||||||
|
c = detailedChange(changeId);
|
||||||
|
assertVotes(c, admin, 0, 0, changeKind);
|
||||||
|
assertVotes(c, user, 0, 0, changeKind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ChangeInfo detailedChange(String changeId) throws Exception {
|
private ChangeInfo detailedChange(String changeId) throws Exception {
|
||||||
return gApi.changes().id(changeId)
|
return gApi.changes().id(changeId)
|
||||||
.get(EnumSet.of(ListChangesOption.DETAILED_LABELS,
|
.get(EnumSet.of(ListChangesOption.DETAILED_LABELS,
|
||||||
|
|||||||
Reference in New Issue
Block a user