diff --git a/access_application_test.go b/access_application_test.go index 0309b6c745d..ffba809fa10 100644 --- a/access_application_test.go +++ b/access_application_test.go @@ -54,7 +54,7 @@ func TestAccessApplications(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) diff --git a/access_bookmark_test.go b/access_bookmark_test.go index 90996859e21..7b082b1409b 100644 --- a/access_bookmark_test.go +++ b/access_bookmark_test.go @@ -36,7 +36,7 @@ func TestAccessBookmarks(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) diff --git a/access_group_test.go b/access_group_test.go index 11f53807962..16bbd436e1f 100644 --- a/access_group_test.go +++ b/access_group_test.go @@ -83,7 +83,7 @@ func TestAccessGroups(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) diff --git a/account_members_test.go b/account_members_test.go index b4d8d8348b9..0834c110cb8 100644 --- a/account_members_test.go +++ b/account_members_test.go @@ -182,7 +182,7 @@ func TestAccountMembers(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -459,7 +459,7 @@ func TestUpdateAccountMember(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -523,7 +523,7 @@ func TestUpdateAccountMemberWithPolicies(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } diff --git a/account_roles_test.go b/account_roles_test.go index 28d45e4028c..7658f3dfecb 100644 --- a/account_roles_test.go +++ b/account_roles_test.go @@ -51,7 +51,7 @@ func TestAccountRoles(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -97,7 +97,7 @@ func TestAccountRole(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) diff --git a/accounts_test.go b/accounts_test.go index bbd0adfb6c1..0f0fecc9c78 100644 --- a/accounts_test.go +++ b/accounts_test.go @@ -48,7 +48,7 @@ func TestAccounts(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -87,7 +87,7 @@ func TestAccount(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -183,7 +183,7 @@ func TestCreateAccount(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) diff --git a/cloudflare_test.go b/cloudflare_test.go index 315f743cb5d..e7ffb09f66b 100644 --- a/cloudflare_test.go +++ b/cloudflare_test.go @@ -181,7 +181,7 @@ func TestClient_RetryCanSucceedAfterErrors(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } diff --git a/custom_pages_test.go b/custom_pages_test.go index 67daebb7921..a8d28beed90 100644 --- a/custom_pages_test.go +++ b/custom_pages_test.go @@ -82,7 +82,7 @@ func TestCustomPagesForZone(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -128,7 +128,7 @@ func TestCustomPagesForAccount(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -172,7 +172,7 @@ func TestCustomPageForZone(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -215,7 +215,7 @@ func TestCustomPageForAccount(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -258,7 +258,7 @@ func TestUpdateCustomPagesForAccount(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -300,7 +300,7 @@ func TestUpdateCustomPagesForZone(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) diff --git a/device_posture_rule_test.go b/device_posture_rule_test.go index e70db35299a..79ce77c511f 100644 --- a/device_posture_rule_test.go +++ b/device_posture_rule_test.go @@ -40,7 +40,7 @@ func TestDevicePostureIntegrations(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } @@ -288,7 +288,7 @@ func TestDevicePostureRules(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) diff --git a/dns_test.go b/dns_test.go index 2f991f56fd8..1c575288da2 100644 --- a/dns_test.go +++ b/dns_test.go @@ -196,7 +196,7 @@ func TestListDNSRecords(t *testing.T) { "count": 1, "page": 1, "per_page": 20, - "total_count": 2000 + "total_count": 1 } }`) } @@ -292,7 +292,7 @@ func TestListDNSRecordsSearch(t *testing.T) { "count": 1, "page": 1, "per_page": 20, - "total_count": 2000 + "total_count": 1 } }`) } @@ -337,7 +337,7 @@ func TestListDNSRecordsSearch(t *testing.T) { Tags: []string{"tag1", "tag2"}, }) require.NoError(t, err) - assert.Equal(t, 2000, resultInfo.Total) + assert.Equal(t, 1, resultInfo.Total) assert.Equal(t, want, actual) } diff --git a/load_balancing_test.go b/load_balancing_test.go index 2bed0cab93e..148746bbce8 100644 --- a/load_balancing_test.go +++ b/load_balancing_test.go @@ -296,7 +296,7 @@ func TestListLoadBalancerPools(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } @@ -760,7 +760,7 @@ func TestListLoadBalancerMonitors(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } @@ -1497,7 +1497,7 @@ func TestListLoadBalancers(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } diff --git a/lockdown_test.go b/lockdown_test.go index 93ee813f065..470fca6bfbb 100644 --- a/lockdown_test.go +++ b/lockdown_test.go @@ -274,7 +274,7 @@ func TestListZoneLockdowns(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } diff --git a/origin_ca_test.go b/origin_ca_test.go index eca1ac28bbe..df79ace0a2a 100644 --- a/origin_ca_test.go +++ b/origin_ca_test.go @@ -129,7 +129,7 @@ func TestOriginCA_OriginCertificates(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) }) diff --git a/pagination.go b/pagination.go index e2ab3735d35..db06ff8a337 100644 --- a/pagination.go +++ b/pagination.go @@ -4,7 +4,7 @@ import ( "math" ) -// Look first for total_pages, but if total_count and per_page are set then use that to get page count +// Look first for total_pages, but if total_count and per_page are set then use that to get page count. func (p ResultInfo) getTotalPages() int { totalPages := p.TotalPages if totalPages == 0 && p.Total > 0 && p.PerPage > 0 { diff --git a/registrar_test.go b/registrar_test.go index 3b58be1603a..c1007a6cc73 100644 --- a/registrar_test.go +++ b/registrar_test.go @@ -163,7 +163,7 @@ func TestRegistrarDomains(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -230,7 +230,7 @@ func TestTransferRegistrarDomain(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) @@ -297,7 +297,7 @@ func TestCancelRegistrarDomainTransfer(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } } `) diff --git a/ssl_test.go b/ssl_test.go index ea43e63cfeb..e7fb3798a38 100644 --- a/ssl_test.go +++ b/ssl_test.go @@ -119,7 +119,7 @@ func TestListSSL(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } @@ -330,7 +330,7 @@ func TestReprioritizeSSL(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } diff --git a/teams_list_test.go b/teams_list_test.go index f9d991a00ff..6dbf384f17b 100644 --- a/teams_list_test.go +++ b/teams_list_test.go @@ -36,7 +36,7 @@ func TestTeamsLists(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000, + "total_count": 1, "total_pages": 1 } } @@ -89,7 +89,7 @@ func TestTeamsList(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000, + "total_count": 1, "total_pages": 1 } } @@ -143,7 +143,7 @@ func TestTeamsListItems(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000, + "total_count": 1, "total_pages": 1 } } diff --git a/turnstile_test.go b/turnstile_test.go index f2193431f4f..38e835514fa 100644 --- a/turnstile_test.go +++ b/turnstile_test.go @@ -122,7 +122,7 @@ func TestTurnstileWidget_List(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) }) diff --git a/waf_test.go b/waf_test.go index 63bc2b034a3..31e19bef018 100644 --- a/waf_test.go +++ b/waf_test.go @@ -39,7 +39,7 @@ func TestListWAFPackages(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } @@ -276,7 +276,7 @@ func TestListWAFGroups(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) } @@ -532,7 +532,7 @@ func TestListWAFRules(t *testing.T) { "page": 1, "per_page": 20, "count": 1, - "total_count": 2000 + "total_count": 1 } }`) }