-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-72443] Do not show copy option without visible items (#8763)
Co-authored-by: Daniel Beck <[email protected]>
- Loading branch information
1 parent
0a94979
commit 7df7ae4
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package jenkins.model; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.CoreMatchers.nullValue; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import hudson.model.Item; | ||
import java.io.IOException; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
import org.jvnet.hudson.test.MockAuthorizationStrategy; | ||
import org.xml.sax.SAXException; | ||
|
||
public class NewJobCopyFromTest { | ||
@Rule | ||
public JenkinsRule j = new JenkinsRule(); | ||
|
||
@Test | ||
public void checkLabel() throws IOException, SAXException { | ||
try (JenkinsRule.WebClient wc = j.createWebClient()) { | ||
// no items - validate assertion | ||
assertThat(wc.goTo("newJob").getElementById("from"), is(nullValue())); | ||
|
||
// actual test | ||
j.createFreeStyleProject(); | ||
j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); | ||
j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy().grant(Item.CREATE, Jenkins.READ).everywhere().toEveryone()); | ||
assertThat(wc.goTo("newJob").getElementById("from"), is(nullValue())); | ||
} | ||
} | ||
} |