Skip to content
Permalink
Browse files

Merge pull request #107 from jenkinsci/modern-testharnes

Use the latest test harness
  • Loading branch information...
oleg-nenashev committed Sep 27, 2016
2 parents 75acfbe + 9809a14 commit 8aec81f23148b5e06612e119f0b981dfd27d2260
@@ -61,7 +61,6 @@
<mockito.version>1.10.19</mockito.version>

<jenkins.version>1.609.3</jenkins.version>
<jenkins-test-harness.version>1.609.3</jenkins-test-harness.version>
<java.level>6</java.level>
<java.level.test>${java.level}</java.level.test>
<findbugs.failOnError>false</findbugs.failOnError>
@@ -25,7 +25,7 @@

@Test
public void testEnvInjectPasswordWrapper() throws Exception {
MatrixProject project = jenkins.createMatrixProject();
MatrixProject project = jenkins.createProject(MatrixProject.class);
EnvInjectPasswordWrapper passwordWrapper = new EnvInjectPasswordWrapper();
passwordWrapper.setPasswordEntries(new EnvInjectPasswordEntry[]{
new EnvInjectPasswordEntry(PWD_KEY, PWD_VALUE)
@@ -6,9 +6,7 @@
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.model.User;
import hudson.security.ACL;
import hudson.security.AccessControlled;
import hudson.security.GlobalMatrixAuthorizationStrategy;
import hudson.security.Permission;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
@@ -22,7 +20,7 @@
import org.junit.Before;
import org.jvnet.hudson.test.CaptureEnvironmentBuilder;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.SingleFileSCM;
import org.jvnet.hudson.test.MockAuthorizationStrategy;

/**
* Tests for {@link EnvInjectPluginAction}.
@@ -100,11 +98,9 @@ public void hideActionViaPermissions() throws Exception {

// Create a test user
User user = User.get("testUser", true, null);

final GlobalMatrixAuthorizationStrategy strategy = new GlobalMatrixAuthorizationStrategy();
strategy.add(Jenkins.READ, user.getId());
strategy.add(Item.READ, user.getId());
strategy.add(Item.DISCOVER, user.getId());

MockAuthorizationStrategy strategy = new MockAuthorizationStrategy().
grant(Jenkins.READ, Item.READ, Item.DISCOVER).everywhere().to(user.getId());
j.jenkins.setAuthorizationStrategy(strategy);

// Run build and retrieve results
@@ -114,8 +110,8 @@ public void hideActionViaPermissions() throws Exception {
assertFalse("User should have no permission to see injected vars",
canViewInjectedVars(user, build));

// Grant permissions and check the results
strategy.add(EnvInjectPlugin.VIEW_INJECTED_VARS, user.getId());
// Grant permissions and check the results
strategy.grant(EnvInjectPlugin.VIEW_INJECTED_VARS).everywhere().to(user.getId());
assertTrue("User should have the View Injected Vars permission",
hasPermission(user, build, EnvInjectPlugin.VIEW_INJECTED_VARS));
assertTrue("User should have a permission to see injected vars",

0 comments on commit 8aec81f

Please sign in to comment.
You can’t perform that action at this time.