Commit 96f2dd1f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

make sure that ldap information is in the controller response

parent 79e53b68
......@@ -253,6 +253,47 @@ public class UserControllerIntegrationTest extends ControllerIntegrationTest {
}
}
@Test
public void testInformationAboutLdapForAllUsers() throws Exception {
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
RequestBuilder grantRequest = get("/users/?columns=login,ldapAccountAvailable,connectedToLdap")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
String response = mockMvc.perform(grantRequest)
.andExpect(status().is2xxSuccessful())
.andReturn().getResponse().getContentAsString();
JsonArray result = new JsonParser()
.parse(response)
.getAsJsonArray();
for (int i = 0; i < result.size(); i++) {
assertNotNull(result.get(i).getAsJsonObject().get("ldapAccountAvailable"));
assertNotNull(result.get(i).getAsJsonObject().get("connectedToLdap"));
logger.debug(result.get(i));
}
}
@Test
public void testInformationAboutLdapForSingleUser() throws Exception {
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
RequestBuilder grantRequest = get("/users/admin/?columns=login,ldapAccountAvailable,connectedToLdap")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
String response = mockMvc.perform(grantRequest)
.andExpect(status().is2xxSuccessful())
.andReturn().getResponse().getContentAsString();
JsonObject result = new JsonParser()
.parse(response)
.getAsJsonObject();
assertNotNull(result.get("ldapAccountAvailable"));
assertNotNull(result.get("connectedToLdap"));
}
@Test
public void testAddUser() throws Exception {
String testLogin = "xyz";
......@@ -283,8 +324,7 @@ public class UserControllerIntegrationTest extends ControllerIntegrationTest {
String body = EntityUtils.toString(new UrlEncodedFormEntity(Arrays.asList(
new BasicNameValuePair("name", "FirstName"),
new BasicNameValuePair("defaultPrivileges", "true")
)));
new BasicNameValuePair("defaultPrivileges", "true"))));
RequestBuilder grantRequest = post("/users/" + testLogin)
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -318,8 +358,7 @@ public class UserControllerIntegrationTest extends ControllerIntegrationTest {
String body = EntityUtils.toString(new UrlEncodedFormEntity(Arrays.asList(
new BasicNameValuePair("name", "FirstName"),
new BasicNameValuePair("defaultPrivileges", "true")
)));
new BasicNameValuePair("defaultPrivileges", "true"))));
RequestBuilder grantRequest = post("/users/" + testLogin)
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment