Skip to content

Commit 2458bd8

Browse files
authored
Adapts to jenkinsci/jenkins#23873 so the tests pass on the current Jenkins version as well as a version containing the PR (#401)
discovered by jenkinsci/bom#6031 in preparation for jenkinsci/jenkins#23873 tested with mvn test -Djenkins.version=2.540-rc37747.87da_150079a_1
1 parent 71ff822 commit 2458bd8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test/java/hudson/tasks/MailerTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
4949
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
5050
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
51+
import org.junit.jupiter.api.BeforeAll;
5152
import org.junit.jupiter.api.Test;
5253
import org.jvnet.hudson.test.Email;
5354
import org.jvnet.hudson.test.FailureBuilder;
@@ -104,6 +105,12 @@ private static Mailbox getMailbox(String recipient) throws Exception {
104105
return Mailbox.get(new InternetAddress(recipient));
105106
}
106107

108+
@BeforeAll
109+
static void enableManagePermission() {
110+
// TODO remove when baseline contains https://github.com/jenkinsci/jenkins/pull/23873
111+
Jenkins.MANAGE.setEnabled(true);
112+
}
113+
107114
private static Mailbox getEmptyMailbox(String recipient) throws Exception {
108115
Mailbox inbox = getMailbox(recipient);
109116
inbox.clear();
@@ -501,7 +508,7 @@ void doCheckSmtpServerShouldThrowExceptionForUserWithoutManagePermissions(Jenkin
501508
rule.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy()
502509
.grant(Jenkins.READ).everywhere().to(USER)
503510
);
504-
final String expectedErrorMessage = "user is missing the Overall/Administer permission";
511+
final String expectedErrorMessage = "user is missing the Overall/Manage permission";
505512

506513
try (ACLContext ignored = ACL.as(User.getById(USER, true))) {
507514
RuntimeException runtimeException = assertThrows(RuntimeException.class,

0 commit comments

Comments
 (0)