From 5f2bab66f4b18122114eb421ab41b42a42d821be Mon Sep 17 00:00:00 2001 From: Justin Littman Date: Tue, 12 Sep 2023 08:53:50 -0700 Subject: [PATCH 1/2] Update cocina models --- Gemfile | 2 +- Gemfile.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index c14284722..8eb586aa8 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'rails', '~> 7.0' # DLSS/domain-specific dependencies -gem 'cocina-models', '~> 0.90.0' +gem 'cocina-models', '~> 0.91.0' gem 'datacite', '~> 0.3.0' gem 'dor-workflow-client', '~> 5.0' gem 'druid-tools', '~> 2.2' diff --git a/Gemfile.lock b/Gemfile.lock index cef849805..1665b32cf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -104,7 +104,7 @@ GEM capistrano-bundler (>= 1.1, < 3) capistrano-shared_configs (0.2.2) chronic (0.10.2) - cocina-models (0.90.0) + cocina-models (0.91.0) activesupport deprecation dry-struct (~> 1.0) @@ -114,15 +114,15 @@ GEM jsonpath nokogiri openapi3_parser - openapi_parser (>= 0.11.1, < 1.0) + openapi_parser (~> 1.0) rss super_diff thor zeitwerk (~> 2.1) coderay (1.1.3) - committee (4.99.1) + committee (5.0.0) json_schema (~> 0.14, >= 0.14.3) - openapi_parser (>= 0.11.1, < 1.0) + openapi_parser (~> 1.0) rack (>= 1.5) commonmarker (0.23.10) concurrent-ruby (1.2.2) @@ -312,7 +312,7 @@ GEM okcomputer (1.18.4) openapi3_parser (0.9.2) commonmarker (~> 0.17) - openapi_parser (0.15.0) + openapi_parser (1.0.0) optimist (3.1.0) parallel (1.23.0) parser (3.2.2.3) @@ -526,7 +526,7 @@ DEPENDENCIES capistrano-passenger capistrano-rails capistrano-shared_configs - cocina-models (~> 0.90.0) + cocina-models (~> 0.91.0) committee config datacite (~> 0.3.0) From 23e4eab3c5e820d79a5f6a64523425f570f2924a Mon Sep 17 00:00:00 2001 From: Justin Littman Date: Tue, 12 Sep 2023 15:32:21 -0700 Subject: [PATCH 2/2] Fix tests --- spec/requests/create_object_spec.rb | 4 ++-- spec/requests/start_accession_spec.rb | 18 ++++++------------ spec/requests/update_metadata_spec.rb | 4 ++-- spec/requests/versions_spec.rb | 18 ++++++------------ 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/spec/requests/create_object_spec.rb b/spec/requests/create_object_spec.rb index 2aebdb1cc..dde101dd6 100644 --- a/spec/requests/create_object_spec.rb +++ b/spec/requests/create_object_spec.rb @@ -679,7 +679,7 @@ view: 'stanford', download: 'none', controlledDigitalLending: false, - embargo: { view: 'world', download: 'world', releaseDate: '2020-02-29' } + embargo: { view: 'world', download: 'world', releaseDate: '2020-02-29T07:00:00.000+00:00' } }) end let(:data) do @@ -688,7 +688,7 @@ "cocinaVersion":"#{Cocina::Models::VERSION}", "type":"#{Cocina::Models::ObjectType.book}", "label":"This is my label","version":1,"access":{"view":"stanford","download":"none","controlledDigitalLending":false, - "embargo":{"view":"world","download":"world","releaseDate":"2020-02-29"}}, + "embargo":{"view":"world","download":"world","releaseDate":"2020-02-29T07:00:00.000+00:00"}}, "administrative":{"releaseTags":[],"hasAdminPolicy":"#{admin_policy_id}"}, "description":{"title":[{"value":"This is my title"}]}, "identification":{"sourceId":"googlebooks:999999"}, diff --git a/spec/requests/start_accession_spec.rb b/spec/requests/start_accession_spec.rb index 1f07af500..de85bf739 100644 --- a/spec/requests/start_accession_spec.rb +++ b/spec/requests/start_accession_spec.rb @@ -40,8 +40,7 @@ end it 'does not open or close a version and starts default workflow' do - post("/v1/objects/#{druid}/accession", - params:, + post("/v1/objects/#{druid}/accession?#{params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" }) expect(response).to be_successful expect(EventFactory).to have_received(:create).with( @@ -55,8 +54,7 @@ end it 'can override the default workflow' do - post "/v1/objects/#{druid}/accession", - params: params.merge(workflow: 'accessionWF'), + post "/v1/objects/#{druid}/accession?#{params.merge(workflow: 'accessionWF').to_query}", headers: { 'Authorization' => "Bearer #{jwt}" } expect(response).to be_successful expect(workflow_client).to have_received(:create_workflow_by_name).with(druid, 'accessionWF', version: '1') @@ -71,8 +69,7 @@ end it 'opens and closes a version and starts default workflow' do - post("/v1/objects/#{druid}/accession", - params:, + post("/v1/objects/#{druid}/accession?#{params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" }) expect(workflow_client).to have_received(:create_workflow_by_name).with(druid, default_start_accession_workflow, version: '2') expect(VersionService).to have_received(:open).with(cocina_object:, **params) @@ -80,8 +77,7 @@ end it 'can override the default workflow' do - post "/v1/objects/#{druid}/accession", - params: params.merge(workflow: 'accessionWF'), + post "/v1/objects/#{druid}/accession?#{params.merge(workflow: 'accessionWF').to_query}", headers: { 'Authorization' => "Bearer #{jwt}" } expect(workflow_client).to have_received(:create_workflow_by_name).with(druid, 'accessionWF', version: '2') expect(VersionService).to have_received(:open).with(cocina_object:, **params) @@ -95,8 +91,7 @@ end it 'closes a version and starts default workflow' do - post("/v1/objects/#{druid}/accession", - params:, + post("/v1/objects/#{druid}/accession?#{params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" }) expect(response).to have_http_status(:success) expect(workflow_client).to have_received(:create_workflow_by_name).with(druid, default_start_accession_workflow, version: '1') @@ -111,8 +106,7 @@ end it 'returns an unacceptable response and does not start any workflows' do - post("/v1/objects/#{druid}/accession", - params:, + post("/v1/objects/#{druid}/accession?#{params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" }) expect(EventFactory).to have_received(:create).with( { data: { workflow: 'assemblyWF' }, diff --git a/spec/requests/update_metadata_spec.rb b/spec/requests/update_metadata_spec.rb index 25d843382..348558a64 100644 --- a/spec/requests/update_metadata_spec.rb +++ b/spec/requests/update_metadata_spec.rb @@ -794,7 +794,7 @@ embargo: { view: 'world', download: 'world', - releaseDate: '2020-02-29' + releaseDate: '2020-02-29T07:00:00.000+00:00' } } ) @@ -807,7 +807,7 @@ "type":"#{Cocina::Models::ObjectType.book}", "label":"This is my label","version":1, "access":{"view":"stanford","download":"stanford", - "embargo":{"view":"world","download":"world","releaseDate":"2020-02-29"} + "embargo":{"view":"world","download":"world","releaseDate":"2020-02-29T07:00:00.000+00:00"} }, "administrative":{"releaseTags":[],"hasAdminPolicy":"#{apo_druid}"}, "description":{ diff --git a/spec/requests/versions_spec.rb b/spec/requests/versions_spec.rb index 92be16fff..ce47e6152 100644 --- a/spec/requests/versions_spec.rb +++ b/spec/requests/versions_spec.rb @@ -46,8 +46,7 @@ end it 'closes the current version when posted to' do - post '/v1/objects/druid:mx123qw2323/versions/current/close', - params: close_params, + post "/v1/objects/druid:mx123qw2323/versions/current/close?#{close_params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" } expect(response).to have_http_status :ok expect(response.body).to match(/version 1 closed/) @@ -64,8 +63,7 @@ end it 'returns an error' do - post '/v1/objects/druid:mx123qw2323/versions/current/close', - params: close_params, + post "/v1/objects/druid:mx123qw2323/versions/current/close?#{close_params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" } expect(response).to have_http_status :unprocessable_entity expect(response.body).to eq( @@ -95,8 +93,7 @@ end it 'opens a new object version when posted to' do - post '/v1/objects/druid:mx123qw2323/versions', - params: open_params, + post "/v1/objects/druid:mx123qw2323/versions?#{open_params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" } expect(response).to be_successful expect(response.body).to equal_cocina_model(cocina_object) @@ -116,8 +113,7 @@ end it 'returns a bad request error' do - post '/v1/objects/druid:mx123qw2323/versions', - params: incomplete_params, + post "/v1/objects/druid:mx123qw2323/versions?#{incomplete_params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" } expect(response.body).to match('missing required parameters: description, significance') expect(response).to have_http_status :bad_request @@ -131,8 +127,7 @@ end it 'returns an error' do - post '/v1/objects/druid:mx123qw2323/versions', - params: open_params, + post "/v1/objects/druid:mx123qw2323/versions?#{open_params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" } expect(response.body).to eq('{"errors":[{"status":"422","title":"Unable to open version","detail":"Object net yet accessioned"}]}') expect(response).to have_http_status :unprocessable_entity @@ -145,8 +140,7 @@ end it 'returns an error' do - post '/v1/objects/druid:mx123qw2323/versions', - params: open_params, + post "/v1/objects/druid:mx123qw2323/versions?#{open_params.to_query}", headers: { 'Authorization' => "Bearer #{jwt}" } expect(response.body).to eq('{"errors":[{"status":"500","title":"Unable to open version due to preservation client error","detail":"Oops, a 500"}]}') expect(response).to have_http_status :internal_server_error