forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New module for integration tests using Playwright framework.
Signed-off-by: Miquel Simon <[email protected]>
- Loading branch information
Showing
22 changed files
with
5,247 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
authz/client/src/test/java/org/keycloak/authorization/client/AuthzClientTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.keycloak.authorization.client; | ||
|
||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import uk.org.webcompere.systemstubs.environment.EnvironmentVariables; | ||
import uk.org.webcompere.systemstubs.jupiter.SystemStub; | ||
import uk.org.webcompere.systemstubs.jupiter.SystemStubsExtension; | ||
|
||
import java.io.ByteArrayInputStream; | ||
|
||
@ExtendWith(SystemStubsExtension.class) | ||
public class AuthzClientTest { | ||
|
||
@SystemStub | ||
public final EnvironmentVariables envVars = new EnvironmentVariables(); | ||
|
||
@Test | ||
public void testCreateWithEnvVars() { | ||
envVars.set("KEYCLOAK_REALM", "test"); | ||
envVars.set("KEYCLOAK_AUTH_SERVER", "http://test"); | ||
|
||
RuntimeException runtimeException = Assertions.assertThrows(RuntimeException.class, () -> { | ||
|
||
AuthzClient.create(new ByteArrayInputStream(("{\n" | ||
+ " \"realm\": \"${env.KEYCLOAK_REALM}\",\n" | ||
+ " \"auth-server-url\": \"${env.KEYCLOAK_AUTH_SERVER}\",\n" | ||
+ " \"ssl-required\": \"external\",\n" | ||
+ " \"enable-cors\": true,\n" | ||
+ " \"resource\": \"my-server\",\n" | ||
+ " \"credentials\": {\n" | ||
+ " \"secret\": \"${env.KEYCLOAK_SECRET}\"\n" | ||
+ " },\n" | ||
+ " \"confidential-port\": 0,\n" | ||
+ " \"policy-enforcer\": {\n" | ||
+ " \"enforcement-mode\": \"ENFORCING\"\n" | ||
+ " }\n" | ||
+ "}").getBytes())); | ||
}); | ||
|
||
MatcherAssert.assertThat(runtimeException.getMessage(), Matchers.containsString("Could not obtain configuration from server")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.