ListView view = new ListView("Test", hudson);
view.getJobFilters().add(filter);
hudson.addView(view);
WebClient web = createWebClient();
Page page = web.goTo("/view/Test/api/json", "application/json");
JSONObject json = (JSONObject)JSONSerializer.toJSON(page.getWebResponse().getContentAsString());
//Just to test that we can find both in an open installation.
assertTrue(json.has("jobs"));
JSONArray jobs = (JSONArray)json.get("jobs");
assertEquals(2, jobs.size());
//Lets secure Jenkins
hudson.setSecurityRealm(createDummySecurityRealm());
hudson.setAuthorizationStrategy(new TestACL());
web = createWebClient();
web = web.login("testuser");
page = web.goTo("/view/Test/api/json", "application/json");
json = (JSONObject)JSONSerializer.toJSON(page.getWebResponse().getContentAsString());
//Does it still applies to secured projects?
assertTrue(json.has("jobs"));
jobs = (JSONArray)json.get("jobs");
assertEquals(1, jobs.size());
}