From 24cd277422c9afd344a9a84236f4112cfc6dbfa8 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sun, 23 Dec 2018 23:51:59 +0100 Subject: [PATCH] schemaOrgId is string --- app/controllers/dois_controller.rb | 1 - app/models/doi.rb | 5 +- spec/requests/dois_spec.rb | 102 ++++++++++++++--------------- 3 files changed, 52 insertions(+), 56 deletions(-) diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index 7556d0074..aa9622cc2 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -468,7 +468,6 @@ def safe_params :downloadLatency, :hasSchemaOrg, :schemaOrgId, - { schemaOrgId: ["@type", :value, :propertyID] }, :dcIdentifier, :citationDoi, :bodyHasPid diff --git a/app/models/doi.rb b/app/models/doi.rb index ff09d6144..7dd0c009e 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -229,10 +229,7 @@ class Doi < ActiveRecord::Base redirectUrls: { type: :keyword }, downloadLatency: { type: :scaled_float, scaling_factor: 100 }, hasSchemaOrg: { type: :boolean }, - schemaOrgId: { type: :object, properties: { - "@type": { type: :keyword }, - value: { type: :keyword }, - propertyID: { type: :keyword }}}, + schemaOrgId: { type: :keyword }, dcIdentifier: { type: :keyword }, citationDoi: { type: :keyword }, bodyHasPid: { type: :boolean } diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb index db81587df..531a202c7 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -1850,61 +1850,61 @@ end end - context 'landing page schema-org-id hash' do - let(:url) { "https://blog.datacite.org/re3data-science-europe/" } - let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) } - let(:landingPage) { { - "checked" => Time.zone.now.utc.iso8601, - "status" => 200, - "url" => url, - "contentType" => "text/html", - "error" => nil, - "redirectCount" => 0, - "redirectUrls" => [], - "downloadLatency" => 200, - "hasSchemaOrg" => true, - "schemaOrgId" => [ - { - "@type" => "PropertyValue", - "value" => "http://dx.doi.org/10.4225/06/564AB348340D5", - "propertyID" => "URL" - } - ], - "dcIdentifier" => nil, - "citationDoi" => nil, - "bodyHasPid" => true - } } - let(:valid_attributes) do - { - "data" => { - "type" => "dois", - "attributes" => { - "doi" => "10.14454/10703", - "url" => url, - "xml" => xml, - "landingPage" => landingPage, - "event" => "publish" - } - } - } - end + # context 'landing page schema-org-id hash' do + # let(:url) { "https://blog.datacite.org/re3data-science-europe/" } + # let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) } + # let(:landingPage) { { + # "checked" => Time.zone.now.utc.iso8601, + # "status" => 200, + # "url" => url, + # "contentType" => "text/html", + # "error" => nil, + # "redirectCount" => 0, + # "redirectUrls" => [], + # "downloadLatency" => 200, + # "hasSchemaOrg" => true, + # "schemaOrgId" => [ + # { + # "@type" => "PropertyValue", + # "value" => "http://dx.doi.org/10.4225/06/564AB348340D5", + # "propertyID" => "URL" + # } + # ], + # "dcIdentifier" => nil, + # "citationDoi" => nil, + # "bodyHasPid" => true + # } } + # let(:valid_attributes) do + # { + # "data" => { + # "type" => "dois", + # "attributes" => { + # "doi" => "10.14454/10703", + # "url" => url, + # "xml" => xml, + # "landingPage" => landingPage, + # "event" => "publish" + # } + # } + # } + # end - before { post '/dois', params: valid_attributes.to_json, headers: headers } + # before { post '/dois', params: valid_attributes.to_json, headers: headers } - it 'creates a Doi' do - expect(json.dig('data', 'attributes', 'url')).to eq(url) - expect(json.dig('data', 'attributes', 'doi')).to eq("10.14454/10703") - expect(json.dig('data', 'attributes', 'landingPage')).to eq(landingPage) - end + # it 'creates a Doi' do + # expect(json.dig('data', 'attributes', 'url')).to eq(url) + # expect(json.dig('data', 'attributes', 'doi')).to eq("10.14454/10703") + # expect(json.dig('data', 'attributes', 'landingPage')).to eq(landingPage) + # end - it 'returns status code 201' do - expect(response).to have_http_status(201) - end + # it 'returns status code 201' do + # expect(response).to have_http_status(201) + # end - it 'sets state to findable' do - expect(json.dig('data', 'attributes', 'state')).to eq("findable") - end - end + # it 'sets state to findable' do + # expect(json.dig('data', 'attributes', 'state')).to eq("findable") + # end + # end end describe 'DELETE /dois/:id' do