X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7ea5b1b2b78ceaa326d8f21ce1d08df0be1d9cda..d6446b03e2f5d5079a870bdd7b963456dc12b485:/services/api/test/integration/discovery_document_test.rb diff --git a/services/api/test/integration/discovery_document_test.rb b/services/api/test/integration/discovery_document_test.rb index b592d61639..37e7750297 100644 --- a/services/api/test/integration/discovery_document_test.rb +++ b/services/api/test/integration/discovery_document_test.rb @@ -31,8 +31,8 @@ class DiscoveryDocumentTest < ActionDispatch::IntegrationTest canonical = Hash[CANONICAL_FIELDS.map { |key| [key, json_response[key]] }] missing = canonical.select { |key| canonical[key].nil? } assert(missing.empty?, "discovery document missing required fields") + actual_json = JSON.pretty_generate(canonical) - expected = JSON.pretty_generate(canonical) # Currently the Python SDK is the only component using this copy of the # discovery document, and storing it with the source simplifies the build # process, so it lives there. If another component wants to use it later, @@ -40,16 +40,16 @@ class DiscoveryDocumentTest < ActionDispatch::IntegrationTest # Python build process will need to be extended to accommodate that. src_path = Rails.root.join("../../sdk/python/arvados-v1-discovery.json") begin - actual = File.open(src_path) { |f| f.read } + expected_json = File.open(src_path) { |f| f.read } rescue Errno::ENOENT - actual = "(#{src_path} not found)" + expected_json = "(#{src_path} not found)" end out_path = Rails.root.join("tmp", "test-arvados-v1-discovery.json") - if expected != actual - File.open(out_path, "w") { |f| f.write(expected) } + if expected_json != actual_json + File.open(out_path, "w") { |f| f.write(actual_json) } end - assert_equal(expected, actual, [ + assert_equal(expected_json, actual_json, [ "#{src_path} did not match the live discovery document", "Current live version saved to #{out_path}", "Commit that to #{src_path} to regenerate documentation",