提交 664f7e34 编写于 作者: K Kohsuke Kawaguchi

More test fixes

上级 e400bc7d
......@@ -209,8 +209,7 @@ public class NodeTest {
j.jenkins.setCrumbIssuer(null);
HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(false);
j.jenkins.setSecurityRealm(realm);
User user = User.get("John Smith");
User user = realm.createAccount("John Smith","abcdef");
SecurityContextHolder.getContext().setAuthentication(user.impersonate());
assertFalse("Current user should not have permission read.", node.hasPermission(Permission.READ));
auth.add(Computer.CONFIGURE, user.getId());
......
......@@ -492,13 +492,13 @@ public class ProjectTest {
@Test
public void testDoCancelQueue() throws Exception{
User user = User.get("John Smith", true, Collections.emptyMap());
FreeStyleProject project = j.createFreeStyleProject("project");
GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
j.jenkins.setCrumbIssuer(null);
HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(false);
j.jenkins.setSecurityRealm(realm);
User user = realm.createAccount("John Smith", "password");
SecurityContextHolder.getContext().setAuthentication(user.impersonate());
try{
project.doCancelQueue(null, null);
......
......@@ -404,8 +404,8 @@ public class UserTest {
j.jenkins.setCrumbIssuer(null);
HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(false);
j.jenkins.setSecurityRealm(realm);
User user = User.get("John Smith");
User user2 = User.get("John Smith2");
User user = realm.createAccount("John Smith","password");
User user2 = realm.createAccount("John Smith2","password");
user2.save();
SecurityContextHolder.getContext().setAuthentication(user.impersonate());
assertFalse("User should not be able delete because he does not have administer permission.", user2.canDelete());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册