Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "1.20.1+261112"
current_version = "1.20.2+261121"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)\\+(?P<build>\\d+)"
serialize = ["{major}.{minor}.{patch}+{build}"]
search = "{current_version}"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rasenmaeher_api"
version = "1.20.1+261112"
version = "1.20.2+261121"
description = "python-rasenmaeher-api"
authors = [
{ name = "Aciid", email = "703382+Aciid@users.noreply.github.com" },
Expand Down
2 changes: 1 addition & 1 deletion src/rasenmaeher_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""python-rasenmaeher-api"""

__version__ = "1.20.1+261112" # NOTE Use `bump-my-version` to bump versions correctly
__version__ = "1.20.2+261121" # NOTE Use `bump-my-version` to bump versions correctly
6 changes: 5 additions & 1 deletion src/rasenmaeher_api/kchelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ async def delete_kc_user(self, user: KCUserData) -> bool:

async def client_access_token(self) -> dict[str, str | int]:
"""Create initial access token for a client to register for OIDC"""
return cast(dict[str, str | int], await self.kcadmin.a_create_initial_access_token())
# Keycloak reads expiration in seconds; python-keycloak defaults to 1, which expires before use.
return cast(
dict[str, str | int],
await self.kcadmin.a_create_initial_access_token(count=1, expiration=60),
)

async def ensure_product_groups(self) -> bool | None:
"""Make sure each product in manifest has a root level group and initial child-group"""
Expand Down
16 changes: 16 additions & 0 deletions tests/test_kchelpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Keycloak helper tests"""

from unittest.mock import AsyncMock, MagicMock

import pytest

from rasenmaeher_api.kchelpers import KCClient


@pytest.mark.asyncio
async def test_client_access_token_outlives_registration() -> None:
"""The initial access token must stay valid long enough to register a client"""
kcadmin = MagicMock()
kcadmin.a_create_initial_access_token = AsyncMock(return_value={"token": "x"})
assert await KCClient(kcadmin).client_access_token() == {"token": "x"}
kcadmin.a_create_initial_access_token.assert_awaited_once_with(count=1, expiration=60)
2 changes: 1 addition & 1 deletion tests/test_rasenmaeher_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

def test_version() -> None:
"""Make sure version matches expected"""
assert __version__ == "1.20.1+261112"
assert __version__ == "1.20.2+261121"


@pytest.mark.asyncio(loop_scope="session")
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading