|
24 | 24 | RemoveBackupOptions, |
25 | 25 | UploadBackupOptions, |
26 | 26 | ) |
| 27 | +from aiohasupervisor.models.backups import BackupLocationAttributes |
27 | 28 |
|
28 | 29 | from . import load_fixture |
29 | 30 | from .const import SUPERVISOR_URL |
@@ -571,3 +572,51 @@ async def test_full_backup_model( |
571 | 572 | """Test full backup model parsing and serializing.""" |
572 | 573 | assert FullBackupOptions.from_dict(as_dict) == options |
573 | 574 | assert options.to_dict() == as_dict |
| 575 | + |
| 576 | + |
| 577 | +async def test_backups_list_location_attributes( |
| 578 | + responses: aioresponses, |
| 579 | + supervisor_client: SupervisorClient, |
| 580 | +) -> None: |
| 581 | + """Test location attributes field in backups list.""" |
| 582 | + responses.get( |
| 583 | + f"{SUPERVISOR_URL}/backups", |
| 584 | + status=200, |
| 585 | + body=load_fixture("backups_list_location_attributes.json"), |
| 586 | + ) |
| 587 | + |
| 588 | + result = await supervisor_client.backups.list() |
| 589 | + assert result[0].location_attributes == { |
| 590 | + ".local": BackupLocationAttributes( |
| 591 | + protected=True, |
| 592 | + size_bytes=10240, |
| 593 | + ), |
| 594 | + "test": BackupLocationAttributes( |
| 595 | + protected=True, |
| 596 | + size_bytes=10240, |
| 597 | + ), |
| 598 | + } |
| 599 | + |
| 600 | + |
| 601 | +async def test_backup_info_location_attributes( |
| 602 | + responses: aioresponses, |
| 603 | + supervisor_client: SupervisorClient, |
| 604 | +) -> None: |
| 605 | + """Test location attributes field in backup info.""" |
| 606 | + responses.get( |
| 607 | + f"{SUPERVISOR_URL}/backups/d9c48f8b/info", |
| 608 | + status=200, |
| 609 | + body=load_fixture("backup_info_location_attributes.json"), |
| 610 | + ) |
| 611 | + |
| 612 | + result = await supervisor_client.backups.backup_info("d9c48f8b") |
| 613 | + assert result.location_attributes == { |
| 614 | + ".local": BackupLocationAttributes( |
| 615 | + protected=True, |
| 616 | + size_bytes=10240, |
| 617 | + ), |
| 618 | + "test": BackupLocationAttributes( |
| 619 | + protected=True, |
| 620 | + size_bytes=10240, |
| 621 | + ), |
| 622 | + } |
0 commit comments