Test insecure, insensitive endpoint with property that's always available
The user property is only available on Unix-like platforms (due to the USER environment variable). This commit updates the test to explicitly set a specific property and then check that it's accessible via the env endpoint rather than using one that is OS-specific. See gh-7868 See gh-7881
This commit is contained in:
@@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
|
||||
"endpoints.env.sensitive=false" })
|
||||
"endpoints.env.sensitive=false", "foo=bar" })
|
||||
public class SampleHypermediaUiSecureApplicationTests {
|
||||
|
||||
@Autowired
|
||||
@@ -47,10 +47,10 @@ public class SampleHypermediaUiSecureApplicationTests {
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/env",
|
||||
String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
ResponseEntity<String> user = this.restTemplate.getForEntity("/env/user",
|
||||
ResponseEntity<String> user = this.restTemplate.getForEntity("/env/foo",
|
||||
String.class);
|
||||
assertThat(user.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(user.getBody()).contains("{\"user\":");
|
||||
assertThat(user.getBody()).contains("{\"foo\":");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user