From 567b606cad20b17db17ae94ae2ec8d778872e696 Mon Sep 17 00:00:00 2001 From: Sheikah45 Date: Sat, 14 Oct 2023 12:25:12 -0400 Subject: [PATCH] Fix server tests --- .../com/faforever/client/remote/ServerAccessorTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/faforever/client/remote/ServerAccessorTest.java b/src/test/java/com/faforever/client/remote/ServerAccessorTest.java index 3c362e6310..a00b2f8cae 100644 --- a/src/test/java/com/faforever/client/remote/ServerAccessorTest.java +++ b/src/test/java/com/faforever/client/remote/ServerAccessorTest.java @@ -59,6 +59,7 @@ import io.netty.handler.codec.string.LineEncoder; import io.netty.handler.codec.string.LineSeparator; import lombok.extern.slf4j.Slf4j; +import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -156,14 +157,18 @@ public void setUp() throws Exception { startFakeFafLobbyServer(); - clientProperties.getServer() - .setUrl("http://%s:%d".formatted(disposableServer.host(), disposableServer.port())); + clientProperties.getUser() + .setBaseUrl("http://localhost:%d".formatted(mockApi.getPort())); clientProperties.setUserAgent("downlords-faf-client"); WebClient webClient = WebClient.builder() .baseUrl(String.format("http://localhost:%s", mockApi.getPort())) .build(); + mockApi.enqueue(new MockResponse() + .setBody(objectMapper.writeValueAsString(new LobbyAccess("http://localhost:%d".formatted(disposableServer.port())))) + .addHeader("Content-Type", "application/json;charset=utf-8")); + instance = new FafServerAccessor(notificationService, i18n, taskScheduler, tokenRetriever, uidService, eventBus, clientProperties, new FafLobbyClient(objectMapper), () -> webClient); instance.afterPropertiesSet();