Merge branch 'stable-2.11'

* stable-2.11:
  Show correct change status for draft patch sets
  Add an acceptance test for pushing changes with Signed-off-by
  Fix client error when current patch set is not visible to user
  ReceiveCommits: Include canonical URL in "change closed" error
  ListDashboards: Use correct channel for logger
  Call NewProjectCreatedListeners after project creation is complete
  PushOneCommit: Fix usage of assertThat

Change-Id: I6cda7b102dae54894f8c88b395aa48572c823d86
This commit is contained in:
David Pursehouse
2015-08-05 17:12:43 +09:00
9 changed files with 70 additions and 22 deletions

View File

@@ -22,6 +22,7 @@ import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.GitUtil;
import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.acceptance.TestAccount;
import com.google.gerrit.extensions.client.InheritableBoolean;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.EditInfo;
import com.google.gerrit.extensions.common.LabelInfo;
@@ -285,4 +286,29 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
PushOneCommit.Result r = pushTo("refs/for/master%hashtag=tag1");
r.assertErrorStatus("cannot add hashtags; noteDb is disabled");
}
@Test
public void testPushCommitUsingSignedOffBy() throws Exception {
PushOneCommit push =
pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT,
"b.txt", "anotherContent");
PushOneCommit.Result r = push.to("refs/for/master");
r.assertOkStatus();
setUseSignedOffBy(InheritableBoolean.TRUE);
blockForgeCommitter(project, "refs/heads/master");
push = pushFactory.create(db, admin.getIdent(), testRepo,
PushOneCommit.SUBJECT + String.format(
"\n\nSigned-off-by: %s <%s>", admin.fullName, admin.email),
"b.txt", "anotherContent");
r = push.to("refs/for/master");
r.assertOkStatus();
push = pushFactory.create(db, admin.getIdent(), testRepo,
PushOneCommit.SUBJECT, "b.txt", "anotherContent");
r = push.to("refs/for/master");
r.assertErrorStatus(
"not Signed-off-by author/committer/uploader in commit message footer");
}
}