Skip to content

Commit

Permalink
refactor: make AbstractHttpClientProxyTest less reliant on OkHttp int…
Browse files Browse the repository at this point in the history
…ernals

Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed Jan 4, 2024
1 parent 5ad8f3b commit 4d4d748
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
package io.fabric8.kubernetes.client.http;

import io.fabric8.mockwebserver.DefaultMockServer;
import okhttp3.Headers;
import okhttp3.mockwebserver.RecordedRequest;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -61,9 +59,8 @@ protected void proxyConfigurationAddsRequiredHeaders() throws Exception {
// Then
assertThat(server.getLastRequest())
.extracting(RecordedRequest::getHeaders)
.extracting(Headers::toMultimap)
.hasFieldOrPropertyWithValue("Host", Collections.singletonList("0.0.0.0:" + server.getPort()))
.hasFieldOrPropertyWithValue("Proxy-Authorization", Collections.singletonList("auth:cred"));
.returns("0.0.0.0:" + server.getPort(), h -> h.get("Host"))
.returns("auth:cred", h -> h.get("Proxy-Authorization"));
}
}
}

0 comments on commit 4d4d748

Please sign in to comment.