Skip to content

Commit

Permalink
get_backup_policy test (#351)
Browse files Browse the repository at this point in the history
Co-authored-by: Anna Lushnikova <[email protected]>
  • Loading branch information
gagan-bhullar-tech and loosla authored Oct 1, 2024
1 parent ca24b18 commit 2cf626e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/mocked/test_droplets.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,37 @@ def test_list_backups(mock_client: Client, mock_client_url):
assert expected == resp


@responses.activate
def test_get_backup_policy(mock_client: Client, mock_client_url):
"""Mocks the droplets get backup policy operation."""

droplet_id = 1

expected = {
"policy": {
"droplet_id": droplet_id,
"backup_policy": {
"plan": "weekly",
"weekday": "SUN",
"hour": 20,
"window_length_hours": 4,
"retention_period_days": 28,
},
}
}

responses.add(
responses.GET,
f"{mock_client_url}/v2/droplets/{droplet_id}/backups/policy",
json=expected,
status=200,
)

resp = mock_client.droplets.get_backup_policy(droplet_id)

assert expected == resp


@responses.activate
def test_list_snapshots(mock_client: Client, mock_client_url):
"""Mocks the droplets list snapshots operation."""
Expand Down

0 comments on commit 2cf626e

Please sign in to comment.