Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[aws|dns] Parse IsTruncated as boolean in list_resource_record_set

Test for proper response format.
  • Loading branch information...
commit 946707a2646e7930ca4947b3f48573fbff4bd527 1 parent 18c91aa
@ktheory ktheory authored
View
4 lib/fog/aws/parsers/dns/list_resource_record_sets.rb
@@ -38,8 +38,10 @@ def end_element(name)
case name
when 'MaxItems'
@response[name] = value.to_i
- when 'IsTruncated', 'NextRecordName', 'NextRecordType'
+ when 'NextRecordName', 'NextRecordType'
@response[name] = value
+ when 'IsTruncated'
+ @response[name] = value == 'true'
end
end
end
View
10 tests/aws/requests/dns/dns_tests.rb
@@ -224,17 +224,11 @@
response.status == 200
}
- test("list resource records") {
+ tests("list resource records").formats(AWS::DNS::Formats::LIST_RESOURCE_RECORD_SETS) {
pending if Fog.mocking?
# get resource records for zone
- response = @r53_connection.list_resource_record_sets( @zone_id)
- if response.status == 200
- record_sets= response.body['ResourceRecordSets']
- num_records= record_sets.count
- end
-
- response.status == 200
+ @r53_connection.list_resource_record_sets(@zone_id).body
}
test("delete #{@new_records.count} resource records") {
View
21 tests/aws/requests/dns/helper.rb
@@ -0,0 +1,21 @@
+class AWS
+ module DNS
+ module Formats
+ RESOURCE_RECORD_SET = {
+ "ResourceRecords" => Array,
+ "Name" => String,
+ "Type" => String,
+ "AliasTarget"=> Fog::Nullable::Hash,
+ "TTL" => Fog::Nullable::String
+ }
+
+ LIST_RESOURCE_RECORD_SETS = {
+ "ResourceRecordSets" => [RESOURCE_RECORD_SET],
+ "IsTruncated" => Fog::Boolean,
+ "MaxItems" => Integer,
+ "NextRecordName" => Fog::Nullable::String,
+ "NextRecordType" => Fog::Nullable::String
+ }
+ end
+ end
+end

0 comments on commit 946707a

Please sign in to comment.
Something went wrong with that request. Please try again.