spetz commented on code in PR #4173:
URL: https://github.com/apache/iggy/pull/4173#discussion_r4002989463
##########
foreign/python/tests/test_user.py:
##########
@@ -361,6 +361,39 @@ async def test_update_username_and_status_together(
await iggy_client.delete_user(created.id)
+ @pytest.mark.asyncio
+ async def test_update_user_with_empty_options_succeeds(
+ self, iggy_client: IggyClient, unique_name
+ ):
+ """Test update_user accepts an empty options map."""
+ username, password = unique_credentials(unique_name)
+ new_username = unique_name(max_bytes=MAX_USERNAME_BYTES)
+ created = await iggy_client.create_user(username, password)
+
+ await iggy_client.update_user(created.id, username=new_username,
options={})
+
+ user = await iggy_client.get_user(created.id)
+ assert user is not None
+ assert user.username == new_username
+
+ await iggy_client.delete_user(created.id)
+
+ @pytest.mark.asyncio
+ async def test_update_user_forwards_options(
+ self, iggy_client: IggyClient, unique_name
+ ):
+ """Test update_user forwards option keys to the server."""
+ username, password = unique_credentials(unique_name)
+ created = await iggy_client.create_user(username, password)
+
+ with pytest.raises(RuntimeError):
Review Comment:
Bare `pytest.raises(RuntimeError)` passes on any RuntimeError, including an
unrelated failure. Mirrors `test_update_stream_forwards_options` so it's
consistent with the existing suite.
##########
foreign/python/src/client.rs:
##########
@@ -354,35 +354,37 @@ impl IggyClient {
/// user_id: User identifier as `str | int`.
/// username: New username as `str | None`; unchanged when `None`.
/// status: New status as `UserStatus | None`; unchanged when `None`.
+ /// options: Additional option keys as `dict[str, str] | None`,
forwarded
+ /// to the server. Current server versions reject all user update
+ /// option keys.
///
/// Returns:
/// An awaitable that resolves to `None` when the user is updated.
///
/// Raises:
/// ValueError: If a string identifier is invalid.
/// RuntimeError: If the request fails.
- #[pyo3(signature = (user_id, username=None, status=None))]
+ #[pyo3(signature = (user_id, username=None, status=None, options=None))]
#[gen_stub(override_return_type(type_repr="collections.abc.Awaitable[None]",
imports=("collections.abc")))]
Review Comment:
Signature spacing is `status=None, options=None` here but `options = None`
in `update_stream`. Cosmetic, rustfmt does not touch attribute contents.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]