mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Update OAuth Actuator sample tests to adapt to sensitivity removal
See gh-9924
This commit is contained in:
parent
52536dc291
commit
5aae23d8ea
@ -69,20 +69,24 @@ public class SampleSecureOAuth2ActuatorApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void healthAvailable() throws Exception {
|
||||
this.mvc.perform(get("/application/health")).andExpect(status().isOk())
|
||||
.andDo(print());
|
||||
public void healthSecured() throws Exception {
|
||||
this.mvc.perform(get("/application/health")).andExpect(status().isUnauthorized());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void envSecuredWithBasic() throws Exception {
|
||||
this.mvc.perform(get("/application/env")).andExpect(status().isUnauthorized())
|
||||
.andExpect(header().string("WWW-Authenticate", containsString("Basic")))
|
||||
.andDo(print());
|
||||
public void healthWithBasicAuthorization() throws Exception {
|
||||
this.mvc.perform(get("/application/health").header("Authorization",
|
||||
"Basic " + Base64Utils.encodeToString("user:password".getBytes())))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void envWithPassword() throws Exception {
|
||||
public void envSecured() throws Exception {
|
||||
this.mvc.perform(get("/application/env")).andExpect(status().isUnauthorized());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void envWithBasicAuthorization() throws Exception {
|
||||
this.mvc.perform(get("/application/env").header("Authorization",
|
||||
"Basic " + Base64Utils.encodeToString("user:password".getBytes())))
|
||||
.andExpect(status().isOk()).andDo(print());
|
||||
|
Loading…
Reference in New Issue
Block a user