Skip to content

Commit

Permalink
Fix server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 committed Oct 14, 2023
1 parent c29a852 commit 567b606
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 567b606

Please sign in to comment.