qa 5.5.1 → 5.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7205f6d228b7548f6dc39ce9781dd4b591d2f4c5e56d5b2bcc4189b3c9005f7e
4
- data.tar.gz: 5cdce31ba635c298e5da88cfc01cc86237426a45a1b8ccf3095c316c1eb7b8f4
3
+ metadata.gz: 427d2d24aab8a8c5a9453dd96aa0f677143ec993f98efb098fdb772c5b5ba429
4
+ data.tar.gz: 7d71a7cfa524b2d12a7b657e11fc0144db1795b48c65690391fc81a5ec2f93af
5
5
  SHA512:
6
- metadata.gz: 39259b1eb80bcaab90653152302e38b853d24ecf1ff9bb46ca16afe637a35fe53b7d4abcf85ee2cc7ee7550b57bb6e7505f558adb10792056ea5573d7607b025
7
- data.tar.gz: 3a748c62a1aa1b05d0f0b768af0a03ea2d2c6918c892c40cfc7ab1fdb619866053fb272d16b20a3241b9024c5d1dde8521fde108c36e33b59d55037d5d618e96
6
+ metadata.gz: c5c375b7b54a7e08f7eff73a473542d36a748ebb0298bad65a91b06177479861d762cdf79d08c72a453fa44df8b94094524bd94a03105bbeb3975873e4a299bc
7
+ data.tar.gz: 205775aa62254267b41f07f6bb3ec5b7f5d5a5f684a70742182b6edc3e77eb406066d6ce829b61f24780d624b7d609fe75832b844bca7e9bf8d2051cfa00517e
@@ -29,7 +29,7 @@ module Qa
29
29
  end
30
30
 
31
31
  def combined_substitutions(action_config, action, action_request, request_header)
32
- substitutions = request_header.fetch(:replacements, {})
32
+ substitutions = request_header.fetch(:replacements, {}).clone
33
33
  substitutions[action_request_variable(action_config, action)] = action_request
34
34
  substitutions[action_subauth_variable(action_config)] = action_subauth_variable_value(action_config, request_header)
35
35
  substitutions[action_language_variable(action_config)] = language_value(action_config, request_header)
@@ -2,14 +2,13 @@
2
2
  "QA_CONFIG_VERSION": "2.1",
3
3
  "prefixes": {
4
4
  "dcterms": "http://purl.org/dc/terms/",
5
- "skos": "http://www.w3.org/2004/02/skos/core#",
6
- "schema": "http://schema.org/"
5
+ "schema": "http://schema.org/"
7
6
  },
8
7
  "term": {
9
8
  "url": {
10
9
  "@context": "http://www.w3.org/ns/hydra/context.jsonld",
11
10
  "@type": "IriTemplate",
12
- "template": "http://id.worldcat.org/fast/{term_id}",
11
+ "template": "http://id.worldcat.org/fast/{term_id}.rdf.xml",
13
12
  "variableRepresentation": "BasicRepresentation",
14
13
  "mapping": [
15
14
  {
@@ -35,14 +34,15 @@
35
34
  "url": {
36
35
  "@context": "http://www.w3.org/ns/hydra/context.jsonld",
37
36
  "@type": "IriTemplate",
38
- "template": "http://experimental.worldcat.org/fast/search?query={subauth}+all+%22{query}%22&sortKeys=usage&{?maximumRecords}",
37
+ "template": "http://experimental.worldcat.org/fast/search?query={subauth}+all+%22{query}%22&sortKeys=usage&maximumRecords={maximumRecords}",
39
38
  "variableRepresentation": "BasicRepresentation",
40
39
  "mapping": [
41
40
  {
42
41
  "@type": "IriTemplateMapping",
43
42
  "variable": "query",
44
43
  "property": "hydra:freetextQuery",
45
- "required": true
44
+ "required": true,
45
+ "encode": true
46
46
  },
47
47
  {
48
48
  "@type": "IriTemplateMapping",
@@ -1,3 +1,3 @@
1
1
  module Qa
2
- VERSION = "5.5.1".freeze
2
+ VERSION = "5.5.2".freeze
3
3
  end
@@ -357,7 +357,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
357
357
  context 'producing internal server error' do
358
358
  context 'when server returns 500' do
359
359
  before do
360
- stub_request(:get, 'http://id.worldcat.org/fast/530369').to_return(status: 500)
360
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml').to_return(status: 500)
361
361
  end
362
362
  it 'returns 500' do
363
363
  expect(Rails.logger).to receive(:warn).with(graph_load_failure)
@@ -369,7 +369,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
369
369
 
370
370
  context 'when data normalization error' do
371
371
  before do
372
- stub_request(:get, 'http://id.worldcat.org/fast/530369')
372
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml')
373
373
  .to_return(status: 200, body: webmock_fixture('lod_oclc_term_bad_id.nt'), headers: { 'Content-Type' => 'application/ntriples' })
374
374
  end
375
375
  it 'returns 500' do
@@ -381,7 +381,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
381
381
 
382
382
  context 'when rdf format error' do
383
383
  before do
384
- stub_request(:get, 'http://id.worldcat.org/fast/530369').to_return(status: 200)
384
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml').to_return(status: 200)
385
385
  allow(RDF::Graph).to receive(:load).and_raise(RDF::FormatError)
386
386
  end
387
387
  it 'returns 500' do
@@ -395,7 +395,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
395
395
 
396
396
  context "when error isn't specifically handled" do
397
397
  before do
398
- stub_request(:get, 'http://id.worldcat.org/fast/530369').to_return(status: 501)
398
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml').to_return(status: 501)
399
399
  end
400
400
  it 'returns 500' do
401
401
  expect(Rails.logger).to receive(:warn).with(graph_load_failure)
@@ -408,7 +408,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
408
408
 
409
409
  context 'when service unavailable' do
410
410
  before do
411
- stub_request(:get, 'http://id.worldcat.org/fast/530369').to_return(status: 503)
411
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml').to_return(status: 503)
412
412
  end
413
413
  it 'returns 503' do
414
414
  expect(Rails.logger).to receive(:warn).with(graph_load_failure)
@@ -420,7 +420,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
420
420
 
421
421
  context 'when requested term is not found at the server' do
422
422
  before do
423
- stub_request(:get, 'http://id.worldcat.org/fast/FAKE_ID').to_return(status: 404, body: '', headers: {})
423
+ stub_request(:get, 'http://id.worldcat.org/fast/FAKE_ID.rdf.xml').to_return(status: 404, body: '', headers: {})
424
424
  end
425
425
  it 'returns 404' do
426
426
  expect(Rails.logger).to receive(:warn).with(graph_load_failure)
@@ -433,7 +433,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
433
433
  context 'in OCLC_FAST authority' do
434
434
  context 'term found' do
435
435
  before do
436
- stub_request(:get, 'http://id.worldcat.org/fast/530369')
436
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml')
437
437
  .to_return(status: 200, body: webmock_fixture('lod_oclc_term_found.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
438
438
  end
439
439
  it 'succeeds and defaults to json content type' do
@@ -481,7 +481,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
481
481
  context 'when cors headers are enabled' do
482
482
  before do
483
483
  Qa.config.enable_cors_headers
484
- stub_request(:get, 'http://id.worldcat.org/fast/530369')
484
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml')
485
485
  .to_return(status: 200, body: webmock_fixture('lod_oclc_term_found.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
486
486
  end
487
487
  it 'Access-Control-Allow-Origin is *' do
@@ -493,7 +493,7 @@ describe Qa::LinkedDataTermsController, type: :controller do
493
493
  context 'when cors headers are disabled' do
494
494
  before do
495
495
  Qa.config.disable_cors_headers
496
- stub_request(:get, 'http://id.worldcat.org/fast/530369')
496
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml')
497
497
  .to_return(status: 200, body: webmock_fixture('lod_oclc_term_found.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
498
498
  end
499
499
  it 'Access-Control-Allow-Origin is not present' do
@@ -8,18 +8,18 @@ RSpec.describe Qa::Authorities::LinkedData::FindTerm do
8
8
  context 'basic parameter testing' do
9
9
  context 'with bad id' do
10
10
  before do
11
- stub_request(:get, 'http://id.worldcat.org/fast/FAKE_ID')
11
+ stub_request(:get, 'http://id.worldcat.org/fast/FAKE_ID.rdf.xml')
12
12
  .to_return(status: 404, body: '', headers: {})
13
13
  end
14
14
  it 'raises a TermNotFound exception' do
15
- expect { lod_oclc.find('FAKE_ID') }.to raise_error Qa::TermNotFound, /.*\/FAKE_ID\ Not Found - Term may not exist at LOD Authority./
15
+ expect { lod_oclc.find('FAKE_ID') }.to raise_error Qa::TermNotFound, /.*\/FAKE_ID.rdf.xml\ Not Found - Term may not exist at LOD Authority./
16
16
  end
17
17
  end
18
18
  end
19
19
 
20
20
  context 'performance stats' do
21
21
  before do
22
- stub_request(:get, 'http://id.worldcat.org/fast/530369')
22
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml')
23
23
  .to_return(status: 200, body: webmock_fixture('lod_oclc_term_found.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
24
24
  end
25
25
  context 'when set to true' do
@@ -55,7 +55,7 @@ RSpec.describe Qa::Authorities::LinkedData::FindTerm do
55
55
 
56
56
  context 'response header' do
57
57
  before do
58
- stub_request(:get, 'http://id.worldcat.org/fast/530369')
58
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml')
59
59
  .to_return(status: 200, body: webmock_fixture('lod_oclc_term_found.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
60
60
  end
61
61
  context 'when set to true' do
@@ -91,7 +91,7 @@ RSpec.describe Qa::Authorities::LinkedData::FindTerm do
91
91
  context 'in OCLC_FAST authority' do
92
92
  context 'term found' do
93
93
  let :results do
94
- stub_request(:get, 'http://id.worldcat.org/fast/530369')
94
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml')
95
95
  .to_return(status: 200, body: webmock_fixture('lod_oclc_term_found.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
96
96
  lod_oclc.find('530369')
97
97
  end
@@ -128,7 +128,7 @@ RSpec.describe Qa::Authorities::LinkedData::FindTerm do
128
128
 
129
129
  context "ID in graph doesn't match ID in request URI" do
130
130
  before do
131
- stub_request(:get, 'http://id.worldcat.org/fast/530369')
131
+ stub_request(:get, 'http://id.worldcat.org/fast/530369.rdf.xml')
132
132
  .to_return(status: 200, body: webmock_fixture('lod_oclc_term_bad_id.nt'), headers: { 'Content-Type' => 'application/ntriples' })
133
133
  end
134
134
 
@@ -83,16 +83,22 @@ RSpec.describe Qa::LinkedData::AuthorityUrlService do
83
83
  let(:action_request) { 'mark twain' }
84
84
 
85
85
  it 'returns template with substitutions' do
86
- expected_url = 'http://experimental.worldcat.org/fast/search?query=oclc.personalName+all+%22mark twain%22&sortKeys=usage&maximumRecords=10'
86
+ expected_url = 'http://experimental.worldcat.org/fast/search?query=oclc.personalName+all+%22mark%20twain%22&sortKeys=usage&maximumRecords=10'
87
87
  expect(subject).to eq expected_url
88
88
  end
89
+
90
+ it 'does not mutate substitutions hash' do
91
+ before_substitutions = substitutions.clone
92
+ subject
93
+ expect(substitutions).to eq before_substitutions
94
+ end
89
95
  end
90
96
 
91
97
  context 'when no substitutions specified' do
92
98
  let(:action_request) { 'mark twain' }
93
99
 
94
100
  it 'returns template with substitutions' do
95
- expected_url = 'http://experimental.worldcat.org/fast/search?query=cql.any+all+%22mark twain%22&sortKeys=usage&maximumRecords=20'
101
+ expected_url = 'http://experimental.worldcat.org/fast/search?query=cql.any+all+%22mark%20twain%22&sortKeys=usage&maximumRecords=20'
96
102
  expect(subject).to eq expected_url
97
103
  end
98
104
  end
@@ -104,7 +110,7 @@ RSpec.describe Qa::LinkedData::AuthorityUrlService do
104
110
  let(:action_request) { 'n79021164' }
105
111
 
106
112
  it 'returns template with substitutions' do
107
- expected_url = 'http://id.worldcat.org/fast/n79021164'
113
+ expected_url = 'http://id.worldcat.org/fast/n79021164.rdf.xml'
108
114
  expect(subject).to eq expected_url
109
115
  end
110
116
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.1
4
+ version: 5.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Anderson
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2020-08-14 00:00:00.000000000 Z
19
+ date: 2020-12-02 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activerecord-import