Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0a48732

Browse files
philogicaePsycojoker
authored andcommittedAug 28, 2024··
Fix right type on create_session
1 parent 5e0c979 commit 0a48732

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed
 

‎src/aleph/sdk/client/vm_confidential_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async def get_certificates(self) -> Tuple[Optional[int], str]:
5656
return None, str(e)
5757

5858
async def create_session(
59-
self, vm_id: ItemHash, certificate_path: Path, policy: int
59+
self, certificate_prefix: str, platform_certificate_path: Path, policy: int
6060
) -> Path:
6161
"""
6262
Create new confidential session
@@ -66,8 +66,8 @@ async def create_session(
6666
args = [
6767
"session",
6868
"--name",
69-
str(vm_id),
70-
str(certificate_path),
69+
certificate_prefix,
70+
str(platform_certificate_path),
7171
str(policy),
7272
]
7373
try:

‎tests/unit/test_vm_confidential_client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,12 @@ async def test_confidential_inject_secret_instance():
186186
@pytest.mark.asyncio
187187
async def test_create_session_command():
188188
account = ETHAccount(private_key=b"0x" + b"1" * 30)
189-
vm_id = ItemHash("cafecafecafecafecafecafecafecafecafecafecafecafecafecafecafecafe")
190189
node_url = "http://localhost"
191190
sevctl_path = Path("/usr/bin/sevctl")
192-
certificates_path = Path("/")
191+
certificate_prefix = (
192+
"cafecafecafecafecafecafecafecafecafecafecafecafecafecafecafecafe/vm"
193+
)
194+
platform_certificate_path = Path("/")
193195
policy = 1
194196

195197
with mock.patch(
@@ -202,14 +204,16 @@ async def test_create_session_command():
202204
node_url=node_url,
203205
session=aiohttp.ClientSession(),
204206
)
205-
_ = await vm_client.create_session(vm_id, certificates_path, policy)
207+
_ = await vm_client.create_session(
208+
certificate_prefix, platform_certificate_path, policy
209+
)
206210
export_mock.assert_called_once_with(
207211
[
208212
str(sevctl_path),
209213
"session",
210214
"--name",
211-
str(vm_id),
212-
str(certificates_path),
215+
certificate_prefix,
216+
str(platform_certificate_path),
213217
str(policy),
214218
],
215219
check=True,

0 commit comments

Comments
 (0)
Please sign in to comment.