Skip to content

Commit

Permalink
Create integration tests with Keycloak testcontainer (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted authored Mar 4, 2024
1 parent 2ca0641 commit f3a6de9
Show file tree
Hide file tree
Showing 8 changed files with 2,646 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
- name: Typing (pyright)
run: poetry run pre-commit run pyright --all-files

# - name: Test
# run: poetry run pytest tests
- name: Test
run: poetry run pytest tests

publish-snapshot-version:
name: Publish snapshot to TestPyPI
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pip install keycloak-oauth[fastapi]
from fastapi import FastAPI
from starlette.middleware.sessions import SessionMiddleware
from backend.settings import settings, BASE_URL, SECRET_KEY # secrets
from keycloak.oauth import KeycloakOAuth2
from keycloak_oauth import KeycloakOAuth2

keycloak = KeycloakOAuth2(
client_id=settings.keycloak.client_id,
Expand Down Expand Up @@ -47,7 +47,7 @@ pip install keycloak-oauth[starlette-admin]
from starlette.middleware.sessions import SessionMiddleware
from starlette_admin.contrib.sqla import Admin
from backend.settings import settings, BASE_URL, SECRET_KEY # secrets
from keycloak.oauth import KeycloakOAuth2
from keycloak_oauth import KeycloakOAuth2
from keycloak.starlette_admin import KeycloakAuthProvider

keycloak = KeycloakOAuth2(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from starlette.routing import Route
from starlette_admin.auth import AdminUser, AuthProvider, login_not_required
from starlette_admin.base import BaseAdmin
from keycloak.oauth import KeycloakOAuth2, User
from keycloak_oauth import KeycloakOAuth2, User


class KeycloakAuthProvider(AuthProvider):
Expand Down
581 changes: 579 additions & 2 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["bakdata <[email protected]>"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/bakdata/python-keycloak-oauth"
packages = [{ include = "keycloak" }]
packages = [{ include = "keycloak_oauth" }]

[tool.poetry.dependencies]
python = "^3.10"
Expand All @@ -28,6 +28,13 @@ pre-commit = "^3.6.2"
ruff = "^0.2.2"
pyright = "^1.1.351"

[tool.poetry.group.test.dependencies]
pytest = "^8.0.1"
pytest-mock = "^3.12.0"
python-keycloak = "^3.9.0"
testcontainers-keycloak = { git = "https://github.com/TheForgottened/testcontainers-python", subdirectory = "keycloak" } # updated Keycloak container: https://github.com/testcontainers/testcontainers-python/pull/369
twill = "^3.2.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit f3a6de9

Please sign in to comment.