Test the returned results rather than an md5 hash of the json. These

tests were breaking on 6.x because certain fields have been
moved/changed
This commit is contained in:
Michael Russell 2018-02-01 11:59:32 +01:00
parent bfced19152
commit fecf5164c8
No known key found for this signature in database
GPG key ID: A90C1696496085FE
2 changed files with 30 additions and 9 deletions

View file

@ -1,4 +1,7 @@
require 'serverspec'
require 'net/http'
require 'json'
set :backend, :exec
require 'rspec/retry'
@ -9,3 +12,15 @@ RSpec.configure do |config|
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true
end
def curl_json(uri, username=nil, password=nil)
uri = URI(uri)
req = Net::HTTP::Get.new(uri)
if username && password
req.basic_auth username, password
end
res = Net::HTTP.start(uri.hostname, uri.port) {|http|
http.request(req)
}
return JSON.parse(res.body)
end