Skip to content

Commit

Permalink
Fix right type on create_session
Browse files Browse the repository at this point in the history
  • Loading branch information
philogicae committed Aug 28, 2024
1 parent 991670c commit 91750ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/aleph/sdk/client/vm_confidential_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def get_certificates(self) -> Tuple[Optional[int], str]:
return None, str(e)

async def create_session(
self, vm_id: ItemHash, certificate_path: Path, policy: int
self, certificate_prefix: str, platform_certificate_path: Path, policy: int
) -> Path:
"""
Create new confidential session
Expand All @@ -66,8 +66,8 @@ async def create_session(
args = [
"session",
"--name",
str(vm_id),
str(certificate_path),
certificate_prefix,
str(platform_certificate_path),
str(policy),
]
try:
Expand Down
14 changes: 9 additions & 5 deletions tests/unit/test_vm_confidential_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ async def test_confidential_inject_secret_instance():
@pytest.mark.asyncio
async def test_create_session_command():
account = ETHAccount(private_key=b"0x" + b"1" * 30)
vm_id = ItemHash("cafecafecafecafecafecafecafecafecafecafecafecafecafecafecafecafe")
node_url = "http://localhost"
sevctl_path = Path("/usr/bin/sevctl")
certificates_path = Path("/")
certificate_prefix = (
"cafecafecafecafecafecafecafecafecafecafecafecafecafecafecafecafe/vm"
)
platform_certificate_path = Path("/")
policy = 1

with mock.patch(
Expand All @@ -202,14 +204,16 @@ async def test_create_session_command():
node_url=node_url,
session=aiohttp.ClientSession(),
)
_ = await vm_client.create_session(vm_id, certificates_path, policy)
_ = await vm_client.create_session(
certificate_prefix, platform_certificate_path, policy
)
export_mock.assert_called_once_with(
[
str(sevctl_path),
"session",
"--name",
str(vm_id),
str(certificates_path),
certificate_prefix,
str(platform_certificate_path),
str(policy),
],
check=True,
Expand Down

0 comments on commit 91750ef

Please sign in to comment.