slbotbm commented on code in PR #4276:
URL: https://github.com/apache/iggy/pull/4276#discussion_r4109168107


##########
foreign/python/tests/test_user.py:
##########
@@ -208,6 +256,43 @@ async def test_create_user_accepts_multibyte_credentials(
         await iggy_client.delete_user(created.id)
 
 
+class TestLoginIdentity:
+    """Test login returns IdentityInfo with transport-specific access_token."""
+
+    @pytest.mark.asyncio
+    async def test_login_user_returns_identity_without_access_token(
+        self, iggy_client: IggyClient
+    ):
+        """Test TCP login returns user_id and no HTTP access token."""
+        root = await iggy_client.get_user("iggy")
+        assert root is not None
+
+        host, port = get_server_config()
+        client = IggyClient(f"{host}:{port}")
+        await client.connect()
+        identity = await client.login_user("iggy", "iggy")
+
+        assert isinstance(identity, IdentityInfo)
+        assert identity.user_id == root.id
+        assert identity.access_token is None
+
+    @pytest.mark.asyncio
+    async def test_login_with_personal_access_token(self, 
personal_access_token):
+        """Test PAT login with a token minted out of band."""

Review Comment:
   What is out of band?



##########
foreign/python/tests/test_user.py:
##########
@@ -30,12 +34,53 @@
     MAX_USERNAME_BYTES,
     MIN_PASSWORD_BYTES,
     MIN_USERNAME_BYTES,
+    get_http_server_config,
     get_server_config,
     unique_credentials,
     wait_for_ping,
     wait_for_server,
 )
 
+# IggyExpiry::NeverExpire serializes as u64::MAX.
+NEVER_EXPIRE = 18446744073709551615
+
+
[email protected]
+def personal_access_token(unique_name):
+    """Mint a PAT via HTTP so login tests do not need the Python create API."""
+    name = unique_name(min_bytes=16, max_bytes=30)

Review Comment:
   There is no need to create a fixture just for one test. Inline this code 
into the test that uses it .



##########
foreign/python/tests/test_http_config.py:
##########
@@ -232,6 +232,26 @@ async def test_client_connects_and_pings(self):
         await client.connect()
         await wait_for_ping(client)
 
+    @pytest.mark.asyncio
+    async def test_login_user_returns_http_access_token(self):
+        """Test HTTP login returns user_id and a session TokenInfo."""

Review Comment:
   Move this into TestLoginIdentity



-- 
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]

Reply via email to