Commit 5aae23d8 authored by Andy Wilkinson's avatar Andy Wilkinson

Update OAuth Actuator sample tests to adapt to sensitivity removal

See gh-9924
parent 52536dc2
...@@ -69,20 +69,24 @@ public class SampleSecureOAuth2ActuatorApplicationTests { ...@@ -69,20 +69,24 @@ public class SampleSecureOAuth2ActuatorApplicationTests {
} }
@Test @Test
public void healthAvailable() throws Exception { public void healthSecured() throws Exception {
this.mvc.perform(get("/application/health")).andExpect(status().isOk()) this.mvc.perform(get("/application/health")).andExpect(status().isUnauthorized());
.andDo(print());
} }
@Test @Test
public void envSecuredWithBasic() throws Exception { public void healthWithBasicAuthorization() throws Exception {
this.mvc.perform(get("/application/env")).andExpect(status().isUnauthorized()) this.mvc.perform(get("/application/health").header("Authorization",
.andExpect(header().string("WWW-Authenticate", containsString("Basic"))) "Basic " + Base64Utils.encodeToString("user:password".getBytes())))
.andDo(print()); .andExpect(status().isOk());
}
@Test
public void envSecured() throws Exception {
this.mvc.perform(get("/application/env")).andExpect(status().isUnauthorized());
} }
@Test @Test
public void envWithPassword() throws Exception { public void envWithBasicAuthorization() throws Exception {
this.mvc.perform(get("/application/env").header("Authorization", this.mvc.perform(get("/application/env").header("Authorization",
"Basic " + Base64Utils.encodeToString("user:password".getBytes()))) "Basic " + Base64Utils.encodeToString("user:password".getBytes())))
.andExpect(status().isOk()).andDo(print()); .andExpect(status().isOk()).andDo(print());
......
Markdown is supported
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