Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-17575] Baseline testing of behavior without folders.
(cherry picked from commit dcff6e4)
  • Loading branch information
jglick authored and olivergondza committed Sep 18, 2013
1 parent c87b32d commit adcdf61
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/src/test/java/hudson/model/AbstractProjectTest.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

/**
Expand Down Expand Up @@ -376,4 +379,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 adcdf61

Please sign in to comment.