From ccec7c6eb6f3873c849f60991d949d3f6a72766a Mon Sep 17 00:00:00 2001 From: Gagan Date: Tue, 1 Oct 2024 12:28:01 -0600 Subject: [PATCH 1/3] list supported backup policies test --- tests/mocked/test_droplets.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/mocked/test_droplets.py b/tests/mocked/test_droplets.py index c4b467c..1979aea 100644 --- a/tests/mocked/test_droplets.py +++ b/tests/mocked/test_droplets.py @@ -572,6 +572,39 @@ def test_list_snapshots(mock_client: Client, mock_client_url): assert expected == resp +@responses.activate +def list_supported_backup_policies(mock_client: Client, mock_client_url): + """Mocks the supported backup policies.""" + + expected = { + "supported_policies": [ + { + "name": "weekly", + "possible_window_starts": [], + "window_length_hours": 2, + "retention_period_days": 20, + }, + { + "name": "daily", + "possible_window_starts": [], + "window_length_hours": 3, + "retention_period_days": 9, + }, + ], + } + + responses.add( + responses.GET, + f"{mock_client_url}/v2/droplets/backups/supported_policies", + json=expected, + status=200, + ) + + resp = mock_client.droplets.list_supported_backup_policies() + + assert expected == resp + + @responses.activate def test_list_kernels(mock_client: Client, mock_client_url): """Mocks the droplets list kernels operation.""" From 2f05dbb9c1364887208bbd745b823527808a3f50 Mon Sep 17 00:00:00 2001 From: Gagan Date: Tue, 1 Oct 2024 12:29:17 -0600 Subject: [PATCH 2/3] fix --- tests/mocked/test_droplets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mocked/test_droplets.py b/tests/mocked/test_droplets.py index 3d881e7..9126839 100644 --- a/tests/mocked/test_droplets.py +++ b/tests/mocked/test_droplets.py @@ -610,7 +610,7 @@ def test_list_snapshots(mock_client: Client, mock_client_url): @responses.activate def list_supported_backup_policies(mock_client: Client, mock_client_url): - """Mocks the supported backup policies.""" + """Mocks the list supported backup policies.""" expected = { "supported_policies": [ From 9416c2b43e8de357651fdd680e20e065b76658a6 Mon Sep 17 00:00:00 2001 From: Gagan Bhullar Date: Tue, 1 Oct 2024 12:32:05 -0600 Subject: [PATCH 3/3] review comments Co-authored-by: Anna Lushnikova --- tests/mocked/test_droplets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mocked/test_droplets.py b/tests/mocked/test_droplets.py index 9126839..c8dfd5f 100644 --- a/tests/mocked/test_droplets.py +++ b/tests/mocked/test_droplets.py @@ -610,7 +610,7 @@ def test_list_snapshots(mock_client: Client, mock_client_url): @responses.activate def list_supported_backup_policies(mock_client: Client, mock_client_url): - """Mocks the list supported backup policies.""" + """Mocks the list of supported backup policies.""" expected = { "supported_policies": [