diff --git a/tests/test_oauth.py b/tests/test_oauth.py index c6b5f6c..adc172d 100644 --- a/tests/test_oauth.py +++ b/tests/test_oauth.py @@ -6,6 +6,7 @@ from starlette.middleware.sessions import SessionMiddleware from keycloak import KeycloakAdmin import pytest +from testcontainers.core.waiting_utils import wait_for_logs from keycloak_oauth import KeycloakOAuth2, User from testcontainers.keycloak import KeycloakContainer from fastapi.testclient import TestClient @@ -30,7 +31,9 @@ def keycloak(self) -> Generator[KeycloakAdmin, None, None]: container, KeycloakContainer ) # HACK: wrong type annotation in testcontainers `with_command` container.with_bind_ports(container.port, container.port).start() + wait_for_logs(container, "Running the server in development mode.") keycloak = container.get_client() + assert keycloak.connection.base_url == container.get_base_api_url() + "/" keycloak.import_realm( json.loads(Path(self.RESOURCES_PATH / "realm.json").read_bytes())