From 15dfa9771f7a603ef66304ecdc9baf50ead583c5 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 9 Apr 2019 22:59:37 +0200 Subject: [PATCH] support contentUrl array. #227 --- app/controllers/dois_controller.rb | 3 ++- spec/requests/dois_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index ea9294324..dd023b533 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -486,6 +486,7 @@ def safe_params ] }, :contentUrl, + { contentUrl: [] }, :sizes, { sizes: [] }, :formats, @@ -584,7 +585,7 @@ def safe_params :metadataVersion, :schemaVersion, :state, :mode, :isActive, :landingPage, :created, :registered, :updated, :lastLandingPage, :version, :lastLandingPageStatus, :lastLandingPageStatusCheck, - :lastLandingPageStatusResult, :lastLandingPageContentType) + :lastLandingPageStatusResult, :lastLandingPageContentType, :contentUrl) end def set_raven_context diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb index 7c07cafa2..673fed179 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -1962,6 +1962,26 @@ end end + context 'update contentUrl' do + let(:content_url) { ["s3://cgp-commons-public/topmed_open_access/197bc047-e917-55ed-852d-d563cdbc50e4/NWD165827.recab.cram", "gs://topmed-irc-share/public/NWD165827.recab.cram"] } + let(:update_attributes) do + { + "data" => { + "type" => "dois", + "attributes" => { + "contentUrl" => content_url + } + } + } + end + + before { patch "/dois/#{doi.doi}", params: update_attributes.to_json, headers: headers } + + it 'updates the Doi' do + expect(json.dig('data', 'attributes', 'contentUrl')).to eq(content_url) + end + end + context 'landing page' do let(:url) { "https://blog.datacite.org/re3data-science-europe/" } let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) }