Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: list backup policies #352

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions tests/mocked/test_droplets.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,42 @@ def test_get_backup_policy(mock_client: Client, mock_client_url):
assert expected == resp


@responses.activate
def test_list_backup_policies(mock_client: Client, mock_client_url):
"""Mocks the droplets list backup policies operation."""

expected = {
"policies": {
"436444618": {
"droplet_id": 436444618,
"backup_enabled": False,
},
"444909706": {
"droplet_id": 444909706,
"backup_enabled": True,
"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/backups/policies",
json=expected,
status=200,
)

resp = mock_client.droplets.list_backup_policies()

assert expected == resp


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