mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-03-09 06:50:05 +00:00
Fix HelloWebflux tests
Fixes gh-4353
This commit is contained in:
parent
dd8952f700
commit
86d0fd77a7
@ -30,6 +30,7 @@ import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.reactive.server.ExchangeResult;
|
||||
import org.springframework.test.web.reactive.server.MockServerExchangeMutator;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
|
||||
|
||||
@ -160,8 +161,10 @@ public class HelloWebfluxApplicationTests {
|
||||
|
||||
@Test
|
||||
public void mockSupport() throws Exception {
|
||||
this.rest
|
||||
.exchangeMutator( withUser() )
|
||||
MockServerExchangeMutator exchangeMutator = new MockServerExchangeMutator(withUser());
|
||||
WebTestClient mockRest = WebTestClient.bindToApplicationContext(this.context).webFilter(exchangeMutator).build();
|
||||
|
||||
exchangeMutator.filterClient(mockRest, withUser())
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -30,6 +30,7 @@ import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.reactive.server.ExchangeResult;
|
||||
import org.springframework.test.web.reactive.server.MockServerExchangeMutator;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
|
||||
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
@ -166,8 +167,10 @@ public class HelloWebfluxFnApplicationTests {
|
||||
|
||||
@Test
|
||||
public void mockSupport() throws Exception {
|
||||
this.rest
|
||||
.exchangeMutator( withUser() )
|
||||
MockServerExchangeMutator exchangeMutator = new MockServerExchangeMutator(withUser());
|
||||
WebTestClient mockRest = WebTestClient.bindToRouterFunction(this.routerFunction).webFilter(exchangeMutator).build();
|
||||
|
||||
exchangeMutator.filterClient(mockRest, withUser())
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
Loading…
x
Reference in New Issue
Block a user