Commit 682d0f52 authored by Andy Wilkinson's avatar Andy Wilkinson

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
parent 8666248d
......@@ -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
......
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