formatting work
This commit is contained in:
@@ -42,10 +42,10 @@ public class SessionControllerTest {
|
||||
@Test
|
||||
public void testRedisControlsSession() {
|
||||
ResponseEntity<String> result = testRestTemplateWithAuth.getForEntity(testUrl, String.class);
|
||||
assertEquals("hello admin", result.getBody()); //login worked
|
||||
assertEquals("hello admin", result.getBody()); // login worked
|
||||
|
||||
Set<String> redisResult = jedis.keys("*");
|
||||
assertTrue(redisResult.size() > 0); //redis is populated with session data
|
||||
assertTrue(redisResult.size() > 0); // redis is populated with session data
|
||||
|
||||
String sessionCookie = result.getHeaders().get("Set-Cookie").get(0).split(";")[0];
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -53,12 +53,12 @@ public class SessionControllerTest {
|
||||
HttpEntity<String> httpEntity = new HttpEntity<>(headers);
|
||||
|
||||
result = testRestTemplate.exchange(testUrl, HttpMethod.GET, httpEntity, String.class);
|
||||
assertEquals("hello admin", result.getBody()); //access with session works worked
|
||||
assertEquals("hello admin", result.getBody()); // access with session works worked
|
||||
|
||||
jedis.flushAll(); //clear all keys in redis
|
||||
jedis.flushAll(); // clear all keys in redis
|
||||
|
||||
result = testRestTemplate.exchange(testUrl, HttpMethod.GET, httpEntity, String.class);
|
||||
assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode());//access denied after sessions are removed in redis
|
||||
assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode());// access denied after sessions are removed in redis
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user