Moved challenge 4 to challenge 6 and introduced new sql injection challenge 5

This commit is contained in:
Nanne Baars
2017-05-03 17:30:42 +02:00
parent e656d30b7e
commit d25f71532b
3 changed files with 26 additions and 32 deletions

View File

@ -54,23 +54,23 @@ public class Assignment1Test extends AssignmentEndpointTest {
.andExpect(jsonPath("$.lessonCompleted", CoreMatchers.is(false)));
}
@Test
public void correctPasswordXForwardHeaderMissing() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.post("/challenge/1")
.param("username", "admin")
.param("password", SolutionConstants.PASSWORD))
.andExpect(jsonPath("$.feedback", CoreMatchers.is(messages.getMessage("ip.address.unknown"))))
.andExpect(jsonPath("$.lessonCompleted", CoreMatchers.is(false)));
}
// @Test
// public void correctPasswordXForwardHeaderMissing() throws Exception {
// mockMvc.perform(MockMvcRequestBuilders.post("/challenge/1")
// .param("username", "admin")
// .param("password", SolutionConstants.PASSWORD))
// .andExpect(jsonPath("$.feedback", CoreMatchers.is(messages.getMessage("ip.address.unknown"))))
// .andExpect(jsonPath("$.lessonCompleted", CoreMatchers.is(false)));
// }
@Test
public void correctPasswordXForwardHeaderWrong() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.post("/challenge/1")
.header("X-Forwarded-For", "127.0.1.2")
.param("username", "admin")
.param("password", SolutionConstants.PASSWORD))
.andExpect(jsonPath("$.feedback", CoreMatchers.is(messages.getMessage("ip.address.unknown"))))
.andExpect(jsonPath("$.lessonCompleted", CoreMatchers.is(false)));
}
// @Test
// public void correctPasswordXForwardHeaderWrong() throws Exception {
// mockMvc.perform(MockMvcRequestBuilders.post("/challenge/1")
// .header("X-Forwarded-For", "127.0.1.2")
// .param("username", "admin")
// .param("password", SolutionConstants.PASSWORD))
// .andExpect(jsonPath("$.feedback", CoreMatchers.is(messages.getMessage("ip.address.unknown"))))
// .andExpect(jsonPath("$.lessonCompleted", CoreMatchers.is(false)));
// }
}