Skip to content

Commit

Permalink
support contentUrl array. #227
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 9, 2019
1 parent e9b28bc commit 15dfa97
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ def safe_params
]
},
:contentUrl,
{ contentUrl: [] },
:sizes,
{ sizes: [] },
:formats,
Expand Down Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down

0 comments on commit 15dfa97

Please sign in to comment.