Skip to content

Commit 7e92f6f

Browse files
authored
Make job id a proper UUID in response model (#48)
1 parent 2a0dc39 commit 7e92f6f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

aiohasupervisor/models/backups.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import datetime
66
from enum import StrEnum
77
from pathlib import PurePath
8+
from uuid import UUID
89

910
from .base import Options, Request, ResponseData
1011

@@ -167,7 +168,7 @@ class PartialBackupOptions(FullBackupOptions, PartialBackupRestoreOptions):
167168
class BackupJob(ResponseData):
168169
"""BackupJob model."""
169170

170-
job_id: str
171+
job_id: UUID
171172

172173

173174
@dataclass(frozen=True, slots=True)

tests/test_backups.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ async def test_backups_full_backup(
207207
callback=backup_callback,
208208
)
209209
result = await supervisor_client.backups.full_backup(options)
210-
assert result.job_id == "dc9dbc16f6ad4de592ffa72c807ca2bf"
210+
assert result.job_id.hex == "dc9dbc16f6ad4de592ffa72c807ca2bf"
211211
assert result.slug == slug
212212

213213

@@ -280,7 +280,7 @@ async def test_backups_partial_backup(
280280
callback=backup_callback,
281281
)
282282
result = await supervisor_client.backups.partial_backup(options)
283-
assert result.job_id == "dc9dbc16f6ad4de592ffa72c807ca2bf"
283+
assert result.job_id.hex == "dc9dbc16f6ad4de592ffa72c807ca2bf"
284284
assert result.slug == slug
285285

286286

@@ -401,7 +401,7 @@ async def test_full_restore(
401401
body=load_fixture("backup_restore.json"),
402402
)
403403
result = await supervisor_client.backups.full_restore("abc123", options)
404-
assert result.job_id == "dc9dbc16f6ad4de592ffa72c807ca2bf"
404+
assert result.job_id.hex == "dc9dbc16f6ad4de592ffa72c807ca2bf"
405405

406406

407407
@pytest.mark.parametrize(
@@ -426,7 +426,7 @@ async def test_partial_restore(
426426
body=load_fixture("backup_restore.json"),
427427
)
428428
result = await supervisor_client.backups.partial_restore("abc123", options)
429-
assert result.job_id == "dc9dbc16f6ad4de592ffa72c807ca2bf"
429+
assert result.job_id.hex == "dc9dbc16f6ad4de592ffa72c807ca2bf"
430430

431431

432432
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)