use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class AlternativeServletContainerTest method init.
@BeforeEach
public void init() {
client = new WireMockTestClient(wm.getPort());
WireMock.configureFor(wm.getPort());
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class HttpsBrowserProxyAcceptanceTest method certificateAuthorityCertCanBeDownloaded.
@Test
@DisabledForJreRange(min = JRE.JAVA_17, disabledReason = "does not support generating certificates at runtime")
public void certificateAuthorityCertCanBeDownloaded() throws Exception {
WireMockTestClient proxyTestClient = new WireMockTestClient(proxy.getPort());
WireMockResponse certResponse = proxyTestClient.get("/__admin/certs/wiremock-ca.crt");
assertEquals(200, certResponse.statusCode());
assertEquals("application/x-pem-file", certResponse.firstHeader("Content-Type"));
Certificate cert = decode(certResponse.content());
X509KeyStore keyStore = new X509KeyStore(HttpsAcceptanceTest.readKeyStore(NO_PREEXISTING_KEYSTORE_PATH, "password"), "password".toCharArray());
assertEquals(keyStore.getCertificateAuthority().certificateChain()[0], cert);
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class RequestFilterAcceptanceTest method initialise.
private void initialise(RequestFilter... filters) {
wm = new WireMockServer(wireMockConfig().dynamicPort().extensions(filters));
wm.start();
client = new WireMockTestClient(wm.port());
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class ResponseDefinitionTransformerAcceptanceTest method doesNotApplyNonGlobalExtensionsWhenNotExplicitlySpecfiedByStub.
@Test
public void doesNotApplyNonGlobalExtensionsWhenNotExplicitlySpecfiedByStub() {
wm = new WireMockServer(wireMockConfig().dynamicPort().extensions(new ExampleTransformer(), new NonGlobalTransformer()));
wm.start();
client = new WireMockTestClient(wm.port());
createStub("/non-global-transform");
WireMockResponse response = client.get("/non-global-transform");
assertThat(response.content(), is("Transformed body"));
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class ResponseDefinitionTransformerAcceptanceTest method appliesNonGlobalExtensionsWhenSpecifiedByStub.
@Test
public void appliesNonGlobalExtensionsWhenSpecifiedByStub() {
wm = new WireMockServer(wireMockConfig().dynamicPort().extensions(new NonGlobalTransformer()));
wm.start();
client = new WireMockTestClient(wm.port());
wm.stubFor(get(urlEqualTo("/local-transform")).willReturn(aResponse().withStatus(200).withBody("Should not see this").withTransformers("local")));
WireMockResponse response = client.get("/local-transform");
assertThat(response.content(), is("Non-global transformed body"));
}
Aggregations