Skip to content

Commit c6209f4

Browse files
fregataaclaude
andcommitted
test(BA-5035): Fix ActionResult initialization in SSH keypair tests
Update test mocks to include required fields for ActionResult classes: - GetSSHKeypairActionResult: add access_key parameter - GenerateSSHKeypairActionResult: add user_id parameter - UploadSSHKeypairActionResult: add user_id parameter Fixes typecheck errors in CI where ActionResult classes require entity/scope identifiers for RBAC validation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 429e13e commit c6209f4

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

tests/unit/manager/api/auth/test_handlers.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,12 @@ async def test_calls_processor_and_returns_public_key(
538538
) -> None:
539539
"""Verify processor is called and public key is returned."""
540540
public_key = "ssh-rsa AAAAB3...\n"
541+
access_key = "AKIAIOSFODNN7EXAMPLE"
541542
mock_processors.auth.get_ssh_keypair.wait_for_complete = AsyncMock(
542-
return_value=GetSSHKeypairActionResult(public_key=public_key)
543+
return_value=GetSSHKeypairActionResult(
544+
public_key=public_key,
545+
access_key=access_key,
546+
)
543547
)
544548

545549
response = await handler.get_ssh_keypair(user_context)
@@ -564,12 +568,14 @@ async def test_calls_processor_and_returns_keypair(
564568
"""Verify processor is called and keypair is returned."""
565569
ssh_public_key = "ssh-rsa NEWPUB...\n"
566570
ssh_private_key = "-----BEGIN RSA PRIVATE KEY-----\n...\n"
571+
user_id = user_context.user_uuid
567572
mock_processors.auth.generate_ssh_keypair.wait_for_complete = AsyncMock(
568573
return_value=GenerateSSHKeypairActionResult(
569574
ssh_keypair=SSHKeypair(
570575
ssh_public_key=ssh_public_key,
571576
ssh_private_key=ssh_private_key,
572-
)
577+
),
578+
user_id=user_id,
573579
)
574580
)
575581

@@ -599,12 +605,14 @@ async def test_calls_processor_and_returns_keypair(
599605
"pubkey": "ssh-rsa AAAAB3...",
600606
"privkey": "-----BEGIN RSA PRIVATE KEY-----\n...",
601607
})
608+
user_id = user_context.user_uuid
602609
mock_processors.auth.upload_ssh_keypair.wait_for_complete = AsyncMock(
603610
return_value=UploadSSHKeypairActionResult(
604611
ssh_keypair=SSHKeypair(
605612
ssh_public_key="ssh-rsa AAAAB3...\n",
606613
ssh_private_key="-----BEGIN RSA PRIVATE KEY-----\n...\n",
607-
)
614+
),
615+
user_id=user_id,
608616
)
609617
)
610618

0 commit comments

Comments
 (0)