diff options
author | David Pursehouse <dpursehouse@collab.net> | 2019-02-26 17:39:51 +0900 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2019-02-26 17:39:51 +0900 |
commit | 879f2db8f06b674edea95e53fd4364911ef67cd6 (patch) | |
tree | e603e1b357c686f27cfff4659f2776b64cf7629b | |
parent | 76294ee83ebbfde5a1827b960de4ba2b880a5fcd (diff) |
AbandonIT: Add tests for changeCleanup.abandonMessage
Test that the URL replacement works correctly when the value is not
configured (i.e. using the default message with URL placeholder), when
the value is configured with the URL placeholder, and when the value is
configured without a URL placeholder.
Change-Id: Ib3a72963c6fa23183f6885e2f6c9c8f926a5aef9
-rw-r--r-- | javatests/com/google/gerrit/acceptance/api/change/AbandonIT.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/javatests/com/google/gerrit/acceptance/api/change/AbandonIT.java b/javatests/com/google/gerrit/acceptance/api/change/AbandonIT.java index 05eca2a394..b626ab34f9 100644 --- a/javatests/com/google/gerrit/acceptance/api/change/AbandonIT.java +++ b/javatests/com/google/gerrit/acceptance/api/change/AbandonIT.java @@ -34,6 +34,7 @@ import com.google.gerrit.extensions.restapi.ResourceConflictException; import com.google.gerrit.reviewdb.client.Project; import com.google.gerrit.server.CurrentUser; import com.google.gerrit.server.change.AbandonUtil; +import com.google.gerrit.server.config.ChangeCleanupConfig; import com.google.gerrit.server.query.change.ChangeData; import com.google.gerrit.testing.TestTimeUtil; import com.google.inject.Inject; @@ -44,6 +45,7 @@ import org.junit.Test; public class AbandonIT extends AbstractDaemonTest { @Inject private AbandonUtil abandonUtil; + @Inject private ChangeCleanupConfig cleanupConfig; @Test public void abandon() throws Exception { @@ -123,6 +125,31 @@ public class AbandonIT extends AbstractDaemonTest { } @Test + public void changeCleanupConfigDefaultAbandonMessage() throws Exception { + assertThat(cleanupConfig.getAbandonMessage()) + .startsWith( + "Auto-Abandoned due to inactivity, see " + + canonicalWebUrl.get() + + "Documentation/user-change-cleanup.html#auto-abandon"); + } + + @Test + @GerritConfig(name = "changeCleanup.abandonMessage", value = "XX ${URL} XX") + public void changeCleanupConfigCustomAbandonMessageWithUrlReplacement() throws Exception { + assertThat(cleanupConfig.getAbandonMessage()) + .isEqualTo( + "XX " + + canonicalWebUrl.get() + + "Documentation/user-change-cleanup.html#auto-abandon XX"); + } + + @Test + @GerritConfig(name = "changeCleanup.abandonMessage", value = "XX YYY XX") + public void changeCleanupConfigCustomAbandonMessageWithoutUrlReplacement() throws Exception { + assertThat(cleanupConfig.getAbandonMessage()).isEqualTo("XX YYY XX"); + } + + @Test public void abandonNotAllowedWithoutPermission() throws Exception { PushOneCommit.Result r = createChange(); String changeId = r.getChangeId(); |