ChangeIT: Request exact set of options that we assert about

This test checks that the withOptions argument is respected. Request
exactly the options we care about for the purposes of the assertions
in this test. This sidesteps the problem of CHECK not working under
notedb, which is not related to what this test is trying to do.

Change-Id: I3fc5168fb3f0ad1077008f221188c094ae0db626
This commit is contained in:
Dave Borowitz
2016-01-28 09:37:42 -05:00
committed by Edwin Kempin
parent 1c7aa94de4
commit f10ac66574

View File

@@ -646,9 +646,24 @@ public class ChangeIT extends AbstractDaemonTest {
@Test
public void queryChangesOptions() throws Exception {
PushOneCommit.Result r = createChange();
ChangeInfo result = Iterables.getOnlyElement(gApi.changes()
.query(r.getChangeId())
.withOptions(EnumSet.allOf(ListChangesOption.class))
.get());
assertThat(result.labels).isNull();
assertThat(result.messages).isNull();
assertThat(result.actions).isNull();
assertThat(result.revisions).isNull();
EnumSet<ListChangesOption> options = EnumSet.of(
ListChangesOption.ALL_REVISIONS,
ListChangesOption.CHANGE_ACTIONS,
ListChangesOption.CURRENT_ACTIONS,
ListChangesOption.DETAILED_LABELS,
ListChangesOption.MESSAGES);
result = Iterables.getOnlyElement(gApi.changes()
.query(r.getChangeId())
.withOptions(options)
.get());
assertThat(Iterables.getOnlyElement(result.labels.keySet()))
.isEqualTo("Code-Review");
@@ -711,6 +726,8 @@ public class ChangeIT extends AbstractDaemonTest {
@Test
public void check() throws Exception {
// TODO(dborowitz): Re-enable when ConsistencyChecker supports notedb.
assume().that(notesMigration.enabled()).isFalse();
PushOneCommit.Result r = createChange();
assertThat(gApi.changes()
.id(r.getChangeId())