Skip to content
Permalink
Browse files
[JENKINS-17575] Baseline testing of behavior without folders.
  • Loading branch information
jglick committed Apr 11, 2013
1 parent f8f9462 commit dcff6e41302093b6ba90da0aa6e9b09a5cfe2b86
Showing with 18 additions and 0 deletions.
  1. +18 −0 test/src/test/java/hudson/model/AbstractProjectTest.java
@@ -24,6 +24,8 @@
package hudson.model;

import com.gargoylesoftware.htmlunit.ElementNotFoundException;
import com.gargoylesoftware.htmlunit.HttpMethod;
import com.gargoylesoftware.htmlunit.WebRequestSettings;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -58,6 +60,7 @@
import org.apache.commons.io.FileUtils;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.URL;
import org.jvnet.hudson.test.MockFolder;

/**
@@ -382,4 +385,19 @@ public void testExternalBuildDirectoryRenameDelete() throws Exception {
assertFalse(b.getRootDir().isDirectory());
}

public void testDeleteRedirect() throws Exception {
createFreeStyleProject("j1");
assertEquals("", deleteRedirectTarget("job/j1"));
createFreeStyleProject("j2");
Jenkins.getInstance().addView(new AllView("v1"));
assertEquals("view/v1/", deleteRedirectTarget("view/v1/job/j2"));
}
private String deleteRedirectTarget(String job) throws Exception {
WebClient wc = new WebClient();
String base = wc.getContextPath();
String loc = wc.getPage(wc.addCrumb(new WebRequestSettings(new URL(base + job + "/doDelete"), HttpMethod.POST))).getWebResponse().getUrl().toString();
assertTrue(loc, loc.startsWith(base));
return loc.substring(base.length());
}

}

0 comments on commit dcff6e4

Please sign in to comment.