mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Fix test failures
This commit is contained in:
parent
8600bd7294
commit
80b5da78a1
@ -23,6 +23,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
@ -35,7 +39,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(properties = "spring.main.web-application-type=reactive")
|
||||
@SpringBootTest(properties = "spring.main.web-application-type=reactive", classes = { WebTestClientSpringBootTestIntegrationTests.TestConfiguration.class,
|
||||
ExampleWebFluxApplication.class })
|
||||
@AutoConfigureWebTestClient
|
||||
public class WebTestClientSpringBootTestIntegrationTests {
|
||||
|
||||
@ -63,4 +68,13 @@ public class WebTestClientSpringBootTestIntegrationTests {
|
||||
.hasSize(1);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class TestConfiguration {
|
||||
@Bean
|
||||
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) throws Exception {
|
||||
http.authorizeExchange().anyExchange().permitAll();
|
||||
return http.build();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ public class SampleOAuth2ClientApplicationTests {
|
||||
String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(entity.getBody())
|
||||
.contains("/oauth2/authorization/code/github-client-1");
|
||||
.contains("/oauth2/authorization/github-client-1");
|
||||
assertThat(entity.getBody())
|
||||
.contains("/oauth2/authorization/code/github-client-2");
|
||||
.contains("/oauth2/authorization/github-client-2");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user