From 3a7bfd290da01046936a36e85a1e0f2a58126cce Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Thu, 31 Oct 2024 09:44:31 -0400 Subject: [PATCH] fix test for listing all policies after changes in a code --- droplets_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/droplets_test.go b/droplets_test.go index ac289be..9f821ae 100644 --- a/droplets_test.go +++ b/droplets_test.go @@ -1018,6 +1018,7 @@ func TestDroplets_ListBackupPolicies(t *testing.T) { defer teardown() ctx := context.Background() + policyID := 123 pt, err := time.Parse(time.RFC3339, "2021-01-01T00:00:00Z") if err != nil { t.Fatalf("unexpected error: %s", err) @@ -1041,12 +1042,16 @@ func TestDroplets_ListBackupPolicies(t *testing.T) { mux.HandleFunc("/v2/droplets/backups/policies", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) - json.NewEncoder(w).Encode(&dropletBackupPoliciesRoot{DropletBackupPolicies: []*DropletBackupPolicy{&testBackupPolicy}}) + json.NewEncoder(w).Encode(&dropletBackupPoliciesRoot{ + DropletBackupPolicies: map[int]*DropletBackupPolicy{policyID: &testBackupPolicy}, + Meta: &Meta{Total: 1}, + Links: &Links{}, + }) }) - policies, _, err := client.Droplets.ListBackupPolicies(ctx) + policies, _, err := client.Droplets.ListBackupPolicies(ctx, &ListOptions{Page: 1}) require.NoError(t, err) - assert.Equal(t, []*DropletBackupPolicy{&testBackupPolicy}, policies) + assert.Equal(t, map[int]*DropletBackupPolicy{policyID: &testBackupPolicy}, policies) } func TestDroplets_ListSupportedBackupPolicies(t *testing.T) {