Search in sources :

Example 1 with SshSession

use of com.google.gerrit.acceptance.SshSession in project gerrit by GerritCodeReview.

the class QueryIT method queryWithNonVisibleCurrentPatchSet.

@Test
public void queryWithNonVisibleCurrentPatchSet() throws Exception {
    String changeId = createChange().getChangeId();
    amendChangeAsDraft(changeId);
    String query = "--current-patch-set --patch-sets " + changeId;
    List<ChangeAttribute> changes = executeSuccessfulQuery(query);
    assertThat(changes.size()).isEqualTo(1);
    assertThat(changes.get(0).patchSets).isNotNull();
    assertThat(changes.get(0).patchSets).hasSize(2);
    assertThat(changes.get(0).currentPatchSet).isNotNull();
    SshSession userSession = new SshSession(server, user);
    initSsh(user);
    userSession.open();
    changes = executeSuccessfulQuery(query, userSession);
    assertThat(changes.size()).isEqualTo(1);
    assertThat(changes.get(0).patchSets).hasSize(1);
    assertThat(changes.get(0).currentPatchSet).isNull();
    userSession.close();
}
Also used : ChangeAttribute(com.google.gerrit.server.data.ChangeAttribute) SshSession(com.google.gerrit.acceptance.SshSession) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Aggregations

AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)1 SshSession (com.google.gerrit.acceptance.SshSession)1 ChangeAttribute (com.google.gerrit.server.data.ChangeAttribute)1 Test (org.junit.Test)1