Skip to content

Commit

Permalink
build(deps): bump github.com/cloudflare/cloudflare-go from 0.58.0 to …
Browse files Browse the repository at this point in the history
…0.59.0 (#367)

* build(deps): bump github.com/cloudflare/cloudflare-go

Bumps [github.com/cloudflare/cloudflare-go](https://github.com/cloudflare/cloudflare-go) from 0.58.0 to 0.59.0.
- [Release notes](https://github.com/cloudflare/cloudflare-go/releases)
- [Changelog](https://github.com/cloudflare/cloudflare-go/blob/master/CHANGELOG.md)
- [Commits](cloudflare/cloudflare-go@v0.58.0...v0.59.0)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/cloudflare-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* test(api): update test cases

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: favonia <[email protected]>
  • Loading branch information
dependabot[bot] and favonia authored Jan 19, 2023
1 parent 09bbaf4 commit f5693d2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/favonia/cloudflare-ddns
go 1.19

require (
github.com/cloudflare/cloudflare-go v0.58.0
github.com/cloudflare/cloudflare-go v0.59.0
github.com/golang/mock v1.6.0
github.com/hashicorp/go-retryablehttp v0.7.2
github.com/jellydator/ttlcache/v3 v3.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/cloudflare/cloudflare-go v0.58.0 h1:m6b12UxePZDtZhcKXMGpzgvFzXLUqlI9u0/uiSP03as=
github.com/cloudflare/cloudflare-go v0.58.0/go.mod h1:QaA8x4JI0/gA/tni1nTdyimFuyEGJi8cB7YSGoFhXFo=
github.com/cloudflare/cloudflare-go v0.59.0 h1:1QFD8h1bIMMVRsCsfoWPwF4eEeXFv59rW5PCVjkCvuk=
github.com/cloudflare/cloudflare-go v0.59.0/go.mod h1:QaA8x4JI0/gA/tni1nTdyimFuyEGJi8cB7YSGoFhXFo=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
19 changes: 12 additions & 7 deletions internal/api/cloudflare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,15 @@ func mockZone(name string, i int, status string) *cloudflare.Zone {
}
}

const (
zonePageSize = 50
dnsRecordPageSize = 100
)

func mockZonesResponse(zoneName string, zoneStatuses []string) *cloudflare.ZonesResponse {
numZones := len(zoneStatuses)

if numZones > 50 {
if numZones > zonePageSize {
panic("mockZonesResponse got too many zone names")
}

Expand All @@ -183,8 +188,8 @@ func mockZonesResponse(zoneName string, zoneStatuses []string) *cloudflare.Zones
Result: zones,
ResultInfo: cloudflare.ResultInfo{
Page: 1,
PerPage: 50,
TotalPages: (numZones + 49) / 50,
PerPage: zonePageSize,
TotalPages: (numZones + zonePageSize - 1) / zonePageSize,
Count: numZones,
Total: numZones,
Cursor: "",
Expand All @@ -206,7 +211,7 @@ func handleZones(t *testing.T, zoneName string, zoneStatuses []string, w http.Re
require.Equal(t, url.Values{
"account.id": {mockAccount},
"name": {zoneName},
"per_page": {"50"},
"per_page": {fmt.Sprintf("%d", zonePageSize)},
}, r.URL.Query())

w.Header().Set("content-type", "application/json")
Expand Down Expand Up @@ -566,7 +571,7 @@ func TestListRecords(t *testing.T) {
require.Equal(t, url.Values{
"name": {"sub.test.org"},
"page": {"1"},
"per_page": {"50"},
"per_page": {fmt.Sprintf("%d", dnsRecordPageSize)},
"type": {ipNet.RecordType()},
}, r.URL.Query())

Expand Down Expand Up @@ -618,7 +623,7 @@ func TestListRecordsInvalidIPAddress(t *testing.T) {
require.Equal(t, url.Values{
"name": {"sub.test.org"},
"page": {"1"},
"per_page": {"50"},
"per_page": {fmt.Sprintf("%d", dnsRecordPageSize)},
"type": {ipNet.RecordType()},
}, r.URL.Query())

Expand Down Expand Up @@ -684,7 +689,7 @@ func TestListRecordsWildcard(t *testing.T) {
require.Equal(t, url.Values{
"name": {"*.test.org"},
"page": {"1"},
"per_page": {"50"},
"per_page": {fmt.Sprintf("%d", dnsRecordPageSize)},
"type": {ipNet.RecordType()},
}, r.URL.Query())

Expand Down

0 comments on commit f5693d2

Please sign in to comment.