Skip to content

Commit

Permalink
Add in test for both content types
Browse files Browse the repository at this point in the history
  • Loading branch information
fhanik committed Sep 22, 2016
1 parent 08cc2e6 commit 1ab7b63
Showing 1 changed file with 11 additions and 4 deletions.
Expand Up @@ -87,14 +87,21 @@ public void logout_and_clear_cookies() {
} }


@Test @Test
public void testAutologinFlow() throws Exception { public void testAutologinFlow_FORM() throws Exception {
testAutologinFlow(MediaType.APPLICATION_FORM_URLENCODED_VALUE);
}
public void testAutologinFlow_JSON() throws Exception {
testAutologinFlow(MediaType.APPLICATION_JSON_VALUE);
}
public void testAutologinFlow(String contentType) throws Exception {
webDriver.get(baseUrl + "/logout.do"); webDriver.get(baseUrl + "/logout.do");


HttpHeaders headers = getAppBasicAuthHttpHeaders(); HttpHeaders headers = getAppBasicAuthHttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, contentType);


Map<String, String> requestBody = new HashMap<>(); MultiValueMap<String,String> requestBody = new LinkedMultiValueMap<>();
requestBody.put("username", testAccounts.getUserName()); requestBody.add("username", testAccounts.getUserName());
requestBody.put("password", testAccounts.getPassword()); requestBody.add("password", testAccounts.getPassword());


ResponseEntity<Map> autologinResponseEntity = restOperations.exchange(baseUrl + "/autologin", ResponseEntity<Map> autologinResponseEntity = restOperations.exchange(baseUrl + "/autologin",
HttpMethod.POST, HttpMethod.POST,
Expand Down

0 comments on commit 1ab7b63

Please sign in to comment.