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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Versions follow [Semantic Versioning](https://semver.org/>) (<major>.<minor>.<patch>).

## [0.2.4] - Unreleased

### Fixed

- ``fake_users`` and ``fake_groups`` was broken. #5

## [0.2.3] - 2025-07-09

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ documentation = "https://pytest-iam.readthedocs.io/en/latest/"

requires-python = ">=3.10"
dependencies = [
"canaille[oidc]>=0.0.77",
"canaille[oidc]>=0.0.78",
"portpicker>=1.6.0",
"pytest>=7.0.0",
"faker>=21.0.0",
Expand Down
11 changes: 6 additions & 5 deletions pytest_iam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def random_user(self, **kwargs) -> User:
"""
with self.app.app_context():
user = fake_users()[0]
user.update(**kwargs)
user.save()
self.backend.update(user, **kwargs)
self.backend.save(user)

return user

Expand All @@ -104,9 +104,10 @@ def random_group(self, **kwargs) -> Group:
Any parameter will be used instead of a random value.
"""
with self.app.app_context():
group = fake_groups(nb_users_max=0)[0]
group.update(**kwargs)
group.save()
groups = fake_groups(nb_users_max=0)
group = groups[0]
self.backend.update(group, **kwargs)
self.backend.save(group)

return group

Expand Down
8 changes: 8 additions & 0 deletions tests/test_client_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,11 @@ def test_account_creation(iam_server, client, test_client):
assert user.user_name == "user"

iam_server.logout()


def test_random_user(iam_server):
assert isinstance(iam_server.random_user(), iam_server.models.User)


def test_random_group(iam_server):
assert isinstance(iam_server.random_group(), iam_server.models.Group)
Loading
Loading