Skip to content

Commit

Permalink
Update cassettes & fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tra0x committed Oct 17, 2024
1 parent d1b2ee8 commit cf82a78
Show file tree
Hide file tree
Showing 11 changed files with 995 additions and 3,183 deletions.

Large diffs are not rendered by default.

88 changes: 44 additions & 44 deletions test/fixtures/vcr_cassettes/cloudflare_test_add_changeset.yml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

178 changes: 89 additions & 89 deletions test/fixtures/vcr_cassettes/cloudflare_test_remove_changeset.yml

Large diffs are not rendered by default.

1,844 changes: 0 additions & 1,844 deletions test/fixtures/vcr_cassettes/cloudflare_test_update_changeset.yml

This file was deleted.

459 changes: 459 additions & 0 deletions test/fixtures/vcr_cassettes/cloudflare_test_update_changeset_after.yml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

930 changes: 0 additions & 930 deletions test/fixtures/vcr_cassettes/cloudflare_test_updating_record_ttl.yml

This file was deleted.

Large diffs are not rendered by default.

56 changes: 14 additions & 42 deletions test/providers/cloudflare_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,22 @@ def test_remove_changeset
end

def test_update_changeset
VCR.use_cassette('cloudflare_test_update_changeset') do
target_fqdn = 'update.record-store-dns-tests.shopitest.com'
record = Record::A.new(fqdn: target_fqdn, ttl: 600, address: '192.0.2.1')
updated_record = record.dup
updated_record.address = '192.0.2.2'
target_fqdn = 'update.record-store-dns-tests.shopitest.com'
record = Record::A.new(fqdn: target_fqdn, ttl: 600, address: '192.0.2.1')
updated_record = record.dup
updated_record.address = '192.0.2.2'
updated_record.ttl = 3600

VCR.use_cassette('cloudflare_test_update_changeset_before') do
@cloudflare.apply_changeset(Changeset.new(
current_records: [],
desired_records: [record],
provider: @cloudflare,
zone: @zone_name,
))
end

VCR.use_cassette('cloudflare_test_update_changeset_after') do
retrieved_records = @cloudflare.retrieve_current_records(zone: @zone_name)
matching_record = retrieved_records.find { |record| record.fqdn == "#{target_fqdn}." }
record.id = matching_record.id
Expand All @@ -266,12 +269,12 @@ def test_update_changeset

updated_record.id = matching_record.id

@cloudflare.apply_changeset(Changeset.new(
current_records: [updated_record],
desired_records: [],
provider: @cloudflare,
zone: @zone_name,
))
# @cloudflare.apply_changeset(Changeset.new(
# current_records: [updated_record],
# desired_records: [],
# provider: @cloudflare,
# zone: @zone_name,
# ))
end
end

Expand All @@ -293,37 +296,6 @@ def test_update_changeset_where_domain_doesnt_exist
end
end

def test_updating_record_ttl
VCR.use_cassette('cloudflare_test_updating_record_ttl') do
target_fqdn = 'ttlupdate.record-store-dns-tests.shopitest.com'
record = Record::A.new(fqdn: target_fqdn, ttl: 600, address: '192.0.2.1')
updated_record = record.dup
updated_record.ttl = 3600

@cloudflare.apply_changeset(Changeset.new(
current_records: [],
desired_records: [record],
provider: @cloudflare,
zone: @zone_name,
))

retrieved_records = @cloudflare.retrieve_current_records(zone: @zone_name)
matching_record = retrieved_records.find { |record| record.fqdn == "#{target_fqdn}." }
record.id = matching_record.id

@cloudflare.apply_changeset(Changeset.new(
current_records: [record],
desired_records: [updated_record],
provider: @cloudflare,
zone: @zone_name,
))

retrieved_records = @cloudflare.retrieve_current_records(zone: @zone_name)
updated_retrieved_record = retrieved_records.find { |r| r.fqdn == record.fqdn }
assert_equal(3600, updated_retrieved_record.ttl)
end
end

def test_alias_record_retrieved_after_adding_record_changeset
VCR.use_cassette('cloudflare_test_alias_record_retrieved_after_adding_record_changeset') do
record = Record::ALIAS.new(
Expand Down

0 comments on commit cf82a78

Please sign in to comment.