From a3576afd239fa0fd2e25ac01eb0974f1e968ca37 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Tue, 31 Jul 2018 09:48:15 +0200 Subject: [PATCH] [JENKINS-52181] - Create Unit test for the new behavior --- test/src/test/java/hudson/cli/ConsoleCommandTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/src/test/java/hudson/cli/ConsoleCommandTest.java b/test/src/test/java/hudson/cli/ConsoleCommandTest.java index a01dd99f17..4fe07e98df 100644 --- a/test/src/test/java/hudson/cli/ConsoleCommandTest.java +++ b/test/src/test/java/hudson/cli/ConsoleCommandTest.java @@ -80,6 +80,17 @@ public class ConsoleCommandTest { assertThat(result, hasNoStandardOutput()); assertThat(result.stderr(), containsString("ERROR: No such job 'aProject'")); } + + @Issue("JENKINS-52181") + @Test public void consoleShouldBeAccessibleForUserWithRead() throws Exception { + j.createFreeStyleProject("aProject"); + final CLICommandInvoker.Result result = command + .authorizedTo(Jenkins.READ, Job.READ) + .invokeWithArgs("aProject"); + + assertThat(result, succeeded()); + assertThat(result.stdout(), containsString("echo 5")); + } @Test public void consoleShouldFailWhenProjectDoesNotExist() throws Exception {