8000 [Quarkus 4] Make the Swagger UI test independent of redirect settings by Pepo48 · Pull Request #55626 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.keycloak.it.cli.dist;

import java.io.IOException;
import java.net.URI;

import org.keycloak.it.junit5.extension.CLIResult;
import org.keycloak.it.junit5.extension.DistributionTest;
Expand All @@ -37,6 +38,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

@DistributionTest(stopServer = Mode.MANUAL, requestPort = 9000, containerExposedPorts = {8080, 9000})
Expand Down Expand Up @@ -77,9 +79,17 @@ void testOpenApiEndpointEnabled(KeycloakDistribution distribution) {
@Test
@Launch({"start-dev", "--openapi-ui-enabled=true", "--openapi-enabled=true", FEATURES_OPTION})
void testOpenApiUiEndpointEnabled(KeycloakDistribution distribution) {
when().get(OPENAPI_UI_ENDPOINT)
String location = given().redirects().follow(false).when().get(OPENAPI_UI_ENDPOINT)
.then()
.statusCode(200);
.statusCode(302)
.extract().header("Location");
URI redirect = URI.create(OPENAPI_UI_ENDPOINT).resolve(location);
assertEquals(URI.create(OPENAPI_UI_ENDPOINT + "/"), redirect);

when().get(redirect.toString())
.then()
.statusCode(200)
.contentType("text/html");
}

@StopServer(Mode.BEFORE_QUARKUS)
Expand Down
Loading
0