提交 eabcaf84 编写于 作者: D Daniel Beck

Switch various tests from using credentials to using matrix-auth

上级 c6f061f2
...@@ -45,24 +45,24 @@ public class PluginTest { ...@@ -45,24 +45,24 @@ public class PluginTest {
@Issue({"SECURITY-131", "SECURITY-155", "SECURITY-705"}) @Issue({"SECURITY-131", "SECURITY-155", "SECURITY-705"})
@Test public void doDynamic() throws Exception { @Test public void doDynamic() throws Exception {
((TestPluginManager) r.jenkins.pluginManager).installDetachedPlugin("credentials"); ((TestPluginManager) r.jenkins.pluginManager).installDetachedPlugin("matrix-auth");
r.createWebClient().goTo("plugin/credentials/images/24x24/credentials.png", "image/png"); r.createWebClient().goTo("plugin/matrix-auth/images/user-disabled.png", "image/png");
r.createWebClient().goTo("plugin/credentials/images/../images/24x24/credentials.png", "image/png"); // collapsed somewhere before it winds up in restOfPath r.createWebClient().goTo("plugin/matrix-auth/images/../images/user-disabled.png", "image/png"); // collapsed somewhere before it winds up in restOfPath
r.createWebClient().assertFails("plugin/credentials/images/%2E%2E/images/24x24/credentials.png", HttpServletResponse.SC_INTERNAL_SERVER_ERROR); // IAE from TokenList.<init> r.createWebClient().assertFails("plugin/matrix-auth/images/%2E%2E/images/user-disabled.png", HttpServletResponse.SC_INTERNAL_SERVER_ERROR); // IAE from TokenList.<init>
r.createWebClient().assertFails("plugin/credentials/images/%252E%252E/images/24x24/credentials.png", HttpServletResponse.SC_BAD_REQUEST); // SECURITY-131 r.createWebClient().assertFails("plugin/matrix-auth/images/%252E%252E/images/user-disabled.png", HttpServletResponse.SC_BAD_REQUEST); // SECURITY-131
r.createWebClient().assertFails("plugin/credentials/images/%25252E%25252E/images/24x24/credentials.png", HttpServletResponse.SC_BAD_REQUEST); // just checking r.createWebClient().assertFails("plugin/matrix-auth/images/%25252E%25252E/images/user-disabled.png", HttpServletResponse.SC_BAD_REQUEST); // just checking
// SECURITY-705: // SECURITY-705:
r.createWebClient().assertFails("plugin/credentials/images/..%2fWEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/images/..%2fWEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST);
r.createWebClient().assertFails("plugin/credentials/./credentials.jpi", /* Path collapsed to simply `credentials.jpi` before entering */ HttpServletResponse.SC_NOT_FOUND); r.createWebClient().assertFails("plugin/matrix-auth/./matrix-auth.jpi", /* Path collapsed to simply `credentials.jpi` before entering */ HttpServletResponse.SC_NOT_FOUND);
r.createWebClient().assertFails("plugin/credentials/images/%2e%2e%2fWEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/images/%2e%2e%2fWEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST);
r.createWebClient().assertFails("plugin/credentials/images/%2e.%2fWEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/images/%2e.%2fWEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST);
r.createWebClient().assertFails("plugin/credentials/images/..%2f..%2f..%2f" + r.jenkins.getRootDir().getName() + "%2fsecrets%2fmaster.key", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/images/..%2f..%2f..%2f" + r.jenkins.getRootDir().getName() + "%2fsecrets%2fmaster.key", HttpServletResponse.SC_BAD_REQUEST);
r.createWebClient().assertFails("plugin/credentials/" + r.jenkins.getRootDir() + "/secrets/master.key", /* ./ prepended anyway */ HttpServletResponse.SC_NOT_FOUND); r.createWebClient().assertFails("plugin/matrix-auth/" + r.jenkins.getRootDir() + "/secrets/master.key", /* ./ prepended anyway */ HttpServletResponse.SC_NOT_FOUND);
// SECURITY-155: // SECURITY-155:
r.createWebClient().assertFails("plugin/credentials/WEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/WEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST);
r.createWebClient().assertFails("plugin/credentials/META-INF/MANIFEST.MF", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/META-INF/MANIFEST.MF", HttpServletResponse.SC_BAD_REQUEST);
r.createWebClient().assertFails("plugin/credentials/web-inf/licenses.xml", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/web-inf/licenses.xml", HttpServletResponse.SC_BAD_REQUEST);
r.createWebClient().assertFails("plugin/credentials/meta-inf/manifest.mf", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/meta-inf/manifest.mf", HttpServletResponse.SC_BAD_REQUEST);
} }
@Ignore("TODO observed to fail in CI with 404 due to external UC issues") @Ignore("TODO observed to fail in CI with 404 due to external UC issues")
...@@ -76,6 +76,6 @@ public class PluginTest { ...@@ -76,6 +76,6 @@ public class PluginTest {
for (Future<UpdateCenter.UpdateCenterJob> job : pluginInstalled) { for (Future<UpdateCenter.UpdateCenterJob> job : pluginInstalled) {
job.get(); job.get();
} }
r.createWebClient().assertFails("plugin/credentials/.timestamp2", HttpServletResponse.SC_BAD_REQUEST); r.createWebClient().assertFails("plugin/matrix-auth/.timestamp2", HttpServletResponse.SC_BAD_REQUEST);
} }
} }
...@@ -72,7 +72,7 @@ public class UsageStatisticsTest { ...@@ -72,7 +72,7 @@ public class UsageStatisticsTest {
*/ */
@Test @Test
public void roundtrip() throws Exception { public void roundtrip() throws Exception {
((TestPluginManager) j.jenkins.pluginManager).installDetachedPlugin("credentials"); ((TestPluginManager) j.jenkins.pluginManager).installDetachedPlugin("matrix-auth");
j.createOnlineSlave(); j.createOnlineSlave();
warmUpNodeMonitorCache(); warmUpNodeMonitorCache();
...@@ -116,7 +116,7 @@ public class UsageStatisticsTest { ...@@ -116,7 +116,7 @@ public class UsageStatisticsTest {
assertThat("No duplicates", reported.contains(name), is(false)); assertThat("No duplicates", reported.contains(name), is(false));
reported.add(name); reported.add(name);
} }
assertThat(reported, hasItem("credentials")); assertThat(reported, hasItem("matrix-auth"));
// Compare content to watch out for backwards compatibility // Compare content to watch out for backwards compatibility
compareWithFile("jobs.json", sortJobTypes((JSONObject) o.get("jobs"))); compareWithFile("jobs.json", sortJobTypes((JSONObject) o.get("jobs")));
......
...@@ -63,13 +63,11 @@ public class I18nTest { ...@@ -63,13 +63,11 @@ public class I18nTest {
@Issue("JENKINS-35270") @Issue("JENKINS-35270")
@Test @Test
public void test_baseName_plugin() throws Exception { public void test_baseName_plugin() throws Exception {
((TestPluginManager) jenkinsRule.jenkins.pluginManager).installDetachedPlugin("credentials"); ((TestPluginManager) jenkinsRule.jenkins.pluginManager).installDetachedPlugin("matrix-auth");
((TestPluginManager) jenkinsRule.jenkins.pluginManager).installDetachedPlugin("ssh-credentials"); JSONObject response = jenkinsRule.getJSON("i18n/resourceBundle?baseName=org.jenkinsci.plugins.matrixauth.Messages").getJSONObject();
((TestPluginManager) jenkinsRule.jenkins.pluginManager).installDetachedPlugin("ssh-slaves");
JSONObject response = jenkinsRule.getJSON("i18n/resourceBundle?baseName=hudson.plugins.sshslaves.Messages").getJSONObject();
Assert.assertEquals(response.toString(), "ok", response.getString("status")); Assert.assertEquals(response.toString(), "ok", response.getString("status"));
JSONObject data = response.getJSONObject("data"); JSONObject data = response.getJSONObject("data");
Assert.assertEquals("The launch timeout must be a number.", data.getString("SSHConnector.LaunchTimeoutMustBeANumber")); Assert.assertEquals("Matrix-based security", data.getString("GlobalMatrixAuthorizationStrategy.DisplayName"));
} }
@Test @Test
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册