Skip to content

Commit c8ffda0

Browse files
authored
Fix query and xml tests (#3087)
1 parent 767ff65 commit c8ffda0

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ end
1818
gem 'json'
1919
gem 'nokogiri', '>= 1.6.8.1'
2020
gem 'oga'
21-
gem 'rexml', '= 3.2.6' # Temporary Workaround (https://github.com/ruby/rexml/issues/131)
21+
gem 'rexml'
2222
# These protocol parsers do not have java gems
2323
unless defined?(JRUBY_VERSION)
2424
gem 'libxml-ruby'

build_tools/aws-sdk-code-generator/spec/protocol-tests-ignore-list.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,5 @@
1111
"engines": ["nokogiri"]
1212
}
1313
}
14-
},
15-
"query": {
16-
"input": {},
17-
"output": {
18-
"QueryCustomizedError": {
19-
"description": "Under investigation",
20-
"engines": ["ox", "nokogiri", "rexml", "libxml", "oga"]
21-
}
22-
}
2314
}
2415
}

build_tools/aws-sdk-code-generator/spec/protocol-tests/output/query.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@
519519
]
520520
},
521521
"description": "Parses customized XML errors",
522-
"errorCode": "CustomCodeError",
522+
"errorCode": "Customized",
523523
"errorMessage": "Hi",
524524
"error": {
525525
"Message": "Hi"

build_tools/aws-sdk-code-generator/spec/protocol_tests_spec_helper.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,13 @@ def match_resp_data(test_case, http_resp, it)
314314
expected_data =
315315
if error_case?(test_case)
316316
error_shape = http_resp.context.operation.errors.find do |err|
317-
err.shape.name == test_case['errorCode']
317+
shape =
318+
if err.shape['error']
319+
err.shape['error']['code']
320+
else
321+
err.shape.name
322+
end
323+
shape == test_case['errorCode']
318324
end
319325
raise "Unable to find #{test_case['errorCode']} in error shapes" if error_shape.nil?
320326

@@ -380,6 +386,8 @@ def normalize_headers(hash)
380386

381387
def normalize_xml(xml)
382388
REXML::Document.new(xml).to_s.gsub(/>\s+?</, '><').strip
389+
rescue REXML::ParseException
390+
xml # payload
383391
end
384392

385393
def error_case?(test_case)

gems/aws-sdk-core/spec/aws/stubbing/protocols/rest_xml_spec.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ def normalize(xml)
8888
operation = api.operation(:get_bucket_policy)
8989
resp = RestXml.new.stub_data(api, operation, params)
9090
expect(resp.status_code).to eq(200)
91-
expect(normalize(resp.body.string)).to eq(normalize(<<-JSON))
92-
{
93-
"Policy": "policy-document"
94-
}
95-
JSON
91+
expect(resp.body.string).to eq('policy-document')
9692
end
9793

9894
it 'can stub errors' do

0 commit comments

Comments
 (0)