exlibris-primo 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/README.rdoc +5 -2
  2. data/Rakefile +1 -5
  3. data/lib/exlibris/primo/eshelf.rb +4 -3
  4. data/lib/exlibris/primo/holding.rb +2 -10
  5. data/lib/exlibris/primo/record.rb +11 -6
  6. data/lib/exlibris/primo/searcher.rb +2 -4
  7. data/lib/exlibris/primo/version.rb +2 -2
  8. data/test/exlibris-primo_test.rb +3 -3
  9. data/test/test_helper.rb +33 -7
  10. data/test/unit/eshelf_test.rb +106 -87
  11. data/test/unit/record_test.rb +64 -45
  12. data/test/unit/searcher_benchmarks.rb +20 -28
  13. data/test/unit/searcher_test.rb +298 -273
  14. data/test/unit/web_service_benchmarks.rb +19 -21
  15. data/test/unit/web_service_test.rb +130 -102
  16. data/test/vcr_cassettes/eshelf_add_invalid_records.yml +107 -0
  17. data/test/vcr_cassettes/eshelf_add_same_record_twice.yml +159 -0
  18. data/test/vcr_cassettes/eshelf_add_to_empty_basket.yml +107 -0
  19. data/test/vcr_cassettes/eshelf_add_to_invalid_basket.yml +55 -0
  20. data/test/vcr_cassettes/eshelf_invalid_eshelf.yml +55 -0
  21. data/test/vcr_cassettes/eshelf_invalid_institution.yml +55 -0
  22. data/test/vcr_cassettes/eshelf_valid_eshelf.yml +2553 -0
  23. data/test/vcr_cassettes/eshelf_valid_eshelf_structure.yml +47 -0
  24. data/test/vcr_cassettes/record.yml +212 -0
  25. data/test/vcr_cassettes/record_invalid_record.yml +55 -0
  26. data/test/vcr_cassettes/record_sub_record.yml +212 -0
  27. data/test/vcr_cassettes/record_valid_record.yml +212 -0
  28. data/test/vcr_cassettes/searcher_base_holdings_by_id.yml +212 -0
  29. data/test/vcr_cassettes/searcher_dedupmrg_by_id.yml +347 -0
  30. data/test/vcr_cassettes/searcher_diacritics1_by_id.yml +207 -0
  31. data/test/vcr_cassettes/searcher_diacritics2_by_id.yml +232 -0
  32. data/test/vcr_cassettes/searcher_holdings_by_id.yml +212 -0
  33. data/test/vcr_cassettes/searcher_invalid_id.yml +55 -0
  34. data/test/vcr_cassettes/searcher_rsrcs_by_id.yml +270 -0
  35. data/test/vcr_cassettes/searcher_search_by_isbn.yml +278 -0
  36. data/test/vcr_cassettes/searcher_search_by_issn.yml +297 -0
  37. data/test/vcr_cassettes/searcher_search_by_title_author_genre.yml +671 -0
  38. data/test/vcr_cassettes/searcher_test_bug_1361.yml +224 -0
  39. data/test/vcr_cassettes/searcher_test_problem_by_id.yml +194 -0
  40. data/test/vcr_cassettes/searcher_tocs_by_id.yml +217 -0
  41. data/test/vcr_cassettes/web_service_author_search.yml +1269 -0
  42. data/test/vcr_cassettes/web_service_bogus_200.yml +392 -0
  43. data/test/vcr_cassettes/web_service_brief_search.yml +299 -0
  44. data/test/vcr_cassettes/web_service_get_eshelf.yml +11823 -0
  45. data/test/vcr_cassettes/web_service_get_eshelf_structure_search.yml +47 -0
  46. data/test/vcr_cassettes/web_service_invalid_document.yml +54 -0
  47. data/test/vcr_cassettes/web_service_isbn_search.yml +299 -0
  48. data/test/vcr_cassettes/web_service_issn_search.yml +293 -0
  49. data/test/vcr_cassettes/web_service_problem_document.yml +193 -0
  50. data/test/vcr_cassettes/web_service_single_document.yml +233 -0
  51. data/test/vcr_cassettes/web_service_title_author_genre_search.yml +719 -0
  52. data/test/vcr_cassettes/web_service_title_search.yml +1035 -0
  53. metadata +147 -77
  54. data/lib/tasks/exlibris-primo_tasks.rake +0 -4
  55. data/test/dummy/README.rdoc +0 -261
  56. data/test/dummy/Rakefile +0 -7
  57. data/test/dummy/app/assets/javascripts/application.js +0 -15
  58. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  59. data/test/dummy/app/controllers/application_controller.rb +0 -3
  60. data/test/dummy/app/helpers/application_helper.rb +0 -2
  61. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  62. data/test/dummy/config.ru +0 -4
  63. data/test/dummy/config/application.rb +0 -56
  64. data/test/dummy/config/boot.rb +0 -10
  65. data/test/dummy/config/database.yml +0 -25
  66. data/test/dummy/config/environment.rb +0 -5
  67. data/test/dummy/config/environments/development.rb +0 -37
  68. data/test/dummy/config/environments/production.rb +0 -67
  69. data/test/dummy/config/environments/test.rb +0 -37
  70. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  71. data/test/dummy/config/initializers/inflections.rb +0 -15
  72. data/test/dummy/config/initializers/mime_types.rb +0 -5
  73. data/test/dummy/config/initializers/secret_token.rb +0 -7
  74. data/test/dummy/config/initializers/session_store.rb +0 -8
  75. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  76. data/test/dummy/config/locales/en.yml +0 -5
  77. data/test/dummy/config/routes.rb +0 -58
  78. data/test/dummy/db/README +0 -0
  79. data/test/dummy/db/test.sqlite3 +0 -0
  80. data/test/dummy/log/test.log +0 -1704
  81. data/test/dummy/public/404.html +0 -26
  82. data/test/dummy/public/422.html +0 -26
  83. data/test/dummy/public/500.html +0 -25
  84. data/test/dummy/public/favicon.ico +0 -0
  85. data/test/dummy/script/rails +0 -6
@@ -1,18 +1,22 @@
1
1
  require 'test_helper'
2
2
 
3
- class RecordTest < ActiveSupport::TestCase
3
+ class RecordTest < Test::Unit::TestCase
4
4
 
5
5
  SEAR_NS = {'sear' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
6
6
 
7
+ class SubRecord < Exlibris::Primo::Record
8
+ def initialize(parameters={})
9
+ super(parameters)
10
+ end
11
+ end
12
+
7
13
  def setup
8
14
  @record_definition = YAML.load( %{
9
15
  base_url: http://bobcat.library.nyu.edu
10
16
  resolver_base_url: https://getit.library.nyu.edu/resolve
11
17
  vid: NYU
12
18
  institution: NYU
13
- record_id: nyu_aleph000062856
14
- })
15
-
19
+ record_id: nyu_aleph000062856 })
16
20
  @base_url = @record_definition["base_url"]
17
21
  @resolver_base_url = @record_definition["resolver_base_url"]
18
22
  @vid = @record_definition["vid"]
@@ -20,58 +24,73 @@ class RecordTest < ActiveSupport::TestCase
20
24
  @valid_record_id = @record_definition["record_id"]
21
25
  @invalid_record_id = "INVALID_RECORD"
22
26
  @setup_args = {
23
- :base_url => @base_url,
24
- :resolver_base_url => @resolver_base_url,
25
- :vid => @vid,
26
- :institution => @institution,
27
- :record_id => @valid_record_id
28
- }
27
+ :base_url => @base_url,
28
+ :resolver_base_url => @resolver_base_url,
29
+ :vid => @vid,
30
+ :institution => @institution,
31
+ :record_id => @valid_record_id }
29
32
  end
30
33
 
31
- test "new" do
34
+ def testnew
32
35
  record = nil
33
- assert_nothing_raised(){ record = Exlibris::Primo::Record.new(@setup_args) }
34
- assert_not_nil(record)
35
- assert_not_nil(record.instance_variable_get(:@record_id))
36
- assert_not_nil(record.instance_variable_get(:@type))
37
- assert_not_nil(record.instance_variable_get(:@title))
38
- assert_not_nil(record.instance_variable_get(:@url))
39
- assert_not_nil(record.instance_variable_get(:@openurl))
40
- assert_not_nil(record.instance_variable_get(:@creator))
41
- assert_not_nil(record.instance_variable_get(:@raw_xml))
36
+ VCR.use_cassette('record valid record') do
37
+ assert_nothing_raised(){ record = Exlibris::Primo::Record.new(@setup_args) }
38
+ assert_not_nil(record)
39
+ assert_not_nil(record.instance_variable_get(:@record_id))
40
+ assert_not_nil(record.instance_variable_get(:@type))
41
+ assert_not_nil(record.instance_variable_get(:@title))
42
+ assert_not_nil(record.instance_variable_get(:@url))
43
+ assert_not_nil(record.instance_variable_get(:@openurl))
44
+ assert_not_nil(record.instance_variable_get(:@creator))
45
+ assert_not_nil(record.instance_variable_get(:@raw_xml))
46
+ end
42
47
  assert_raise(ArgumentError){ Exlibris::Primo::Record.new(@setup_args.merge({:base_url => nil})) }
43
48
  assert_raise(ArgumentError){ Exlibris::Primo::Record.new(@setup_args.merge({:institution => nil})) }
44
49
  assert_raise(ArgumentError){ Exlibris::Primo::Record.new(@setup_args.merge({:vid => nil})) }
45
50
  assert_raise(ArgumentError){ Exlibris::Primo::Record.new(@setup_args.merge({:record_id => nil})) }
46
- assert_raise(RuntimeError){ Exlibris::Primo::Record.new(@setup_args.merge({:record_id => @invalid_record_id})) }
51
+ VCR.use_cassette('record invalid record') do
52
+ assert_raise(RuntimeError){ Exlibris::Primo::Record.new(@setup_args.merge({:record_id => @invalid_record_id})) }
53
+ end
47
54
  end
48
-
49
- test "to_hash_function" do
50
- record = Exlibris::Primo::Record.new(@setup_args)
51
- assert((record.to_h.is_a? Hash), "#{record.class} was expected to be a Hash, was #{record.to_h.class}")
55
+
56
+ def testto_hash_function
57
+ VCR.use_cassette('record valid record') do
58
+ record = Exlibris::Primo::Record.new(@setup_args)
59
+ assert((record.to_h.is_a? Hash), "#{record.class} was expected to be a Hash, was #{record.to_h.class}")
60
+ assert(record.to_h["format"], "BOOK")
61
+ assert(record.to_h["title"], "Travels with my aunt")
62
+ assert(record.to_h["author"], "Graham Greene 1904-1991.")
63
+ assert(record.to_h["url"], "#{@base_url}/primo_library/libweb/action/dlDisplay.do?dym=false&onCampus=false&docId=nyu_aleph000062856&institution=#{@institution}&vid=#{@vid}")
64
+ end
52
65
  end
53
-
54
- test "sub_class" do
55
- class SubRecord < Exlibris::Primo::Record
56
- def initialize(parameters={})
57
- super(parameters)
58
- end
66
+
67
+ def testto_json_function
68
+ VCR.use_cassette('record valid record') do
69
+ record = Exlibris::Primo::Record.new(@setup_args)
70
+ assert((record.to_json.is_a? String), "#{record.class} was expected to be a Hash, was #{record.to_json.class}")
71
+ assert(record.to_json.starts_with? '{"record":{"control":{"sourcerecordid":"000062856","sourceid":"nyu_aleph","recordid":"nyu_aleph000062856","originalsourceid":"NYU01","ilsapiid":"NYU01000062856","sourceformat":"MARC21","sourcesystem":"Aleph"}')
59
72
  end
73
+ end
74
+
75
+ def testsub_class
60
76
  record = nil
61
- assert_nothing_raised(){ record = SubRecord.new(@setup_args) }
62
- assert_not_nil(record)
63
- assert_raise(ArgumentError){ record = SubRecord.new() }
77
+ VCR.use_cassette('record sub record') do
78
+ assert_nothing_raised(){ record = SubRecord.new(@setup_args) }
79
+ assert_not_nil(record)
80
+ assert_raise(ArgumentError){ record = SubRecord.new() }
81
+ end
64
82
  end
65
-
66
- test "raw_xml" do
67
- record = Exlibris::Primo::Record.new(@setup_args)
68
- raw_xml = record.instance_variable_get(:@raw_xml)
69
- assert_not_nil(raw_xml)
70
- assert_instance_of(String, raw_xml)
71
- doc = nil
72
- assert_nothing_raised(){ doc = Nokogiri::XML.parse(raw_xml) }
73
- assert_not_nil(doc)
74
- assert_not_empty(doc.xpath("//record", doc.namespaces))
83
+
84
+ def testraw_xml
85
+ VCR.use_cassette('record') do
86
+ record = Exlibris::Primo::Record.new(@setup_args)
87
+ raw_xml = record.instance_variable_get(:@raw_xml)
88
+ assert_not_nil(raw_xml)
89
+ assert_instance_of(String, raw_xml)
90
+ doc = nil
91
+ assert_nothing_raised(){ doc = Nokogiri::XML.parse(raw_xml) }
92
+ assert_not_nil(doc)
93
+ assert(doc.xpath("//record", doc.namespaces).size > 0)
94
+ end
75
95
  end
76
-
77
96
  end
@@ -1,29 +1,27 @@
1
1
  require 'test_helper'
2
- class SearcherTest < ActiveSupport::TestCase
2
+ class SearcherTest < Test::Unit::TestCase
3
3
  PNX_NS = {'pnx' => 'http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib'}
4
4
  SEARCH_NS = {'search' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
5
5
 
6
6
  def setup
7
7
  @primo_definition = YAML.load( %{
8
- type: PrimoService
9
- priority: 2 # After SFX, to get SFX metadata enhancement
10
- status: active
11
- base_url: http://bobcat.library.nyu.edu
12
- vid: NYU
13
- institution: NYU
14
- holding_search_institution: NYU
15
- holding_search_text: Search for this title in BobCat.
16
- suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
17
- ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
18
- service_types:
19
- - primo_source
20
- - holding_search
21
- - fulltext
22
- - table_of_contents
23
- - referent_enhance
24
- - cover_image
25
- })
26
-
8
+ type: PrimoService
9
+ priority: 2 # After SFX, to get SFX metadata enhancement
10
+ status: active
11
+ base_url: http://bobcat.library.nyu.edu
12
+ vid: NYU
13
+ institution: NYU
14
+ holding_search_institution: NYU
15
+ holding_search_text: Search for this title in BobCat.
16
+ suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
17
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
18
+ service_types:
19
+ - primo_source
20
+ - holding_search
21
+ - fulltext
22
+ - table_of_contents
23
+ - referent_enhance
24
+ - cover_image })
27
25
  @base_url = @primo_definition["base_url"]
28
26
  @vid = @primo_definition["vid"]
29
27
  @institution = @primo_definition["institution"]
@@ -49,17 +47,11 @@ class SearcherTest < ActiveSupport::TestCase
49
47
  :base_url => @base_url,
50
48
  :institution => @institution,
51
49
  :vid => @vid,
52
- :config => @primo_config
53
- }
54
-
55
- @searcher_setup_without_config = {
56
- :base_url => @base_url,
57
- :institution => @institution,
58
- :vid => @vid
50
+ :config => @primo_definition
59
51
  }
60
52
  end
61
53
 
62
- test "benchmarks" do
54
+ def testbenchmarks
63
55
  Benchmark.bmbm do |results|
64
56
  results.report("Primo Searcher:") {
65
57
  (1..10).each {
@@ -1,30 +1,28 @@
1
1
  # encoding: utf-8
2
2
  require 'test_helper'
3
- class SearcherTest < ActiveSupport::TestCase
3
+ class SearcherTest < Test::Unit::TestCase
4
4
  PNX_NS = {'pnx' => 'http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib'}
5
5
  SEARCH_NS = {'search' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
6
6
 
7
7
  def setup
8
8
  @primo_definition = YAML.load( %{
9
- type: PrimoService
10
- priority: 2 # After SFX, to get SFX metadata enhancement
11
- status: active
12
- base_url: http://bobcat.library.nyu.edu
13
- vid: NYU
14
- institution: NYU
15
- holding_search_institution: NYU
16
- holding_search_text: Search for this title in BobCat.
17
- suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
18
- ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
19
- service_types:
20
- - primo_source
21
- - holding_search
22
- - fulltext
23
- - table_of_contents
24
- - referent_enhance
25
- - cover_image
26
- })
27
-
9
+ type: PrimoService
10
+ priority: 2 # After SFX, to get SFX metadata enhancement
11
+ status: active
12
+ base_url: http://bobcat.library.nyu.edu
13
+ vid: NYU
14
+ institution: NYU
15
+ holding_search_institution: NYU
16
+ holding_search_text: Search for this title in BobCat.
17
+ suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
18
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
19
+ service_types:
20
+ - primo_source
21
+ - holding_search
22
+ - fulltext
23
+ - table_of_contents
24
+ - referent_enhance
25
+ - cover_image })
28
26
  @base_url = @primo_definition["base_url"]
29
27
  @vid = @primo_definition["vid"]
30
28
  @institution = @primo_definition["institution"]
@@ -52,7 +50,6 @@ class SearcherTest < ActiveSupport::TestCase
52
50
  :vid => @vid,
53
51
  :config => @primo_definition
54
52
  }
55
-
56
53
  @searcher_setup_without_config = {
57
54
  :base_url => @base_url,
58
55
  :institution => @institution,
@@ -61,297 +58,323 @@ class SearcherTest < ActiveSupport::TestCase
61
58
  end
62
59
 
63
60
  # Test search for a single Primo document.
64
- test "search_by_doc_id" do
65
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
66
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
67
- search_results = searcher.response
68
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
69
- assert_equal(@primo_holdings_doc_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
70
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_holdings_doc_id}.")
61
+ def testsearch_by_doc_id
62
+ VCR.use_cassette('searcher holdings by id') do
63
+ searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
64
+ assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
65
+ search_results = searcher.response
66
+ assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
67
+ assert_equal(@primo_holdings_doc_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
68
+ assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_holdings_doc_id}.")
69
+ end
71
70
  end
72
71
 
73
72
  # Test search for a Primo problem record
74
- test "search_by_genre_discrepancy" do
75
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_test_problem_doc_id})
76
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
77
- search_results = searcher.response
78
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
79
- assert_equal(@primo_test_problem_doc_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
80
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_test_problem_doc_id}.")
81
- assert_equal(1, searcher.holdings.length, "#{searcher.class} returned unexpected holdings")
73
+ def testsearch_by_genre_discrepancy
74
+ VCR.use_cassette('searcher test problem by id') do
75
+ searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_test_problem_doc_id})
76
+ assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
77
+ search_results = searcher.response
78
+ assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
79
+ assert_equal(@primo_test_problem_doc_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
80
+ assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_test_problem_doc_id}.")
81
+ assert_equal(1, searcher.holdings.length, "#{searcher.class} returned unexpected holdings")
82
+ end
82
83
  end
83
84
 
84
- test "search_by_bug1361" do
85
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_test_bug1361_id})
86
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
87
- search_results = searcher.response
88
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
89
- assert_equal(@primo_test_bug1361_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
90
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_test_bug1361_id}.")
91
- assert_equal(0, searcher.holdings.length, "#{searcher.class} returned unexpected holdings")
92
- assert_equal(4, searcher.rsrcs.length, "#{searcher.class} returned unexpected rsrcs")
85
+ def testsearch_by_bug1361
86
+ VCR.use_cassette('searcher test bug 1361') do
87
+ searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_test_bug1361_id})
88
+ assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
89
+ search_results = searcher.response
90
+ assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
91
+ assert_equal(@primo_test_bug1361_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
92
+ assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_test_bug1361_id}.")
93
+ assert_equal(0, searcher.holdings.length, "#{searcher.class} returned unexpected holdings")
94
+ assert_equal(4, searcher.rsrcs.length, "#{searcher.class} returned unexpected rsrcs")
95
+ end
93
96
  end
94
97
 
95
98
  # Test search for an invalid Primo document.
96
- test "search_by_invalid_doc_id" do
97
- assert_raise(RuntimeError) {
98
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_invalid_doc_id})
99
- }
99
+ def testsearch_by_invalid_doc_id
100
+ VCR.use_cassette('searcher invalid id') do
101
+ assert_raise(RuntimeError) {
102
+ searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_invalid_doc_id})
103
+ }
104
+ end
100
105
  end
101
106
 
102
107
  # Test invalid setup.
103
- test "search_by_invalid_setup1" do
108
+ def testsearch_by_invalid_setup1
104
109
  assert_raise(RuntimeError) {
105
110
  searcher = Exlibris::Primo::Searcher.new({}, {:primo_id => @primo_invalid_doc_id})
106
111
  }
107
112
  end
108
113
 
109
114
  # Test invalid setup.
110
- test "search_by_invalid_setup2" do
115
+ def testsearch_by_invalid_setup2
111
116
  assert_raise(RuntimeError) {
112
117
  searcher = Exlibris::Primo::Searcher.new({:base_url => @base_url, :config => nil}, {:primo_id => @primo_invalid_doc_id})
113
118
  }
114
119
  end
115
120
 
116
121
  # Test base setup search for a single Primo document.
117
- test "search_base_setup_record_id" do
118
- searcher = Exlibris::Primo::Searcher.new({:base_url => @base_url, :institution => @institution}, {:primo_id => @primo_holdings_doc_id})
119
- holdings = searcher.holdings
120
- assert_instance_of(Array, holdings, "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
121
- assert(holdings.count > 0, "#{searcher.class} returned 0 holdings for doc id: #{@primo_holdings_doc_id}.")
122
- first_holding = holdings.first
123
- assert_instance_of(Exlibris::Primo::Holding, first_holding, "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
124
- assert_equal("check_holdings", first_holding.status, "#{searcher.class} first holding has an unexpected status: #{first_holding.status}")
125
- assert_equal("NYU", first_holding.institution, "#{searcher.class} first holding has an unexpected institution: #{first_holding.institution}")
126
- assert_equal("BOBST", first_holding.library, "#{searcher.class} first holding has an unexpected library: #{first_holding.library}")
127
- assert_equal("Main Collection", first_holding.collection, "#{searcher.class} first holding has an unexpected collection: #{first_holding.collection}")
128
- assert_equal("(PR6013.R44 T7 2004 )", first_holding.call_number, "#{searcher.class} first holding has an unexpected call number: #{first_holding.call_number}")
122
+ def testsearch_base_setup_record_id
123
+ VCR.use_cassette('searcher base holdings by id') do
124
+ searcher = Exlibris::Primo::Searcher.new({:base_url => @base_url, :institution => @institution}, {:primo_id => @primo_holdings_doc_id})
125
+ holdings = searcher.holdings
126
+ assert_instance_of(Array, holdings, "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
127
+ assert(holdings.count > 0, "#{searcher.class} returned 0 holdings for doc id: #{@primo_holdings_doc_id}.")
128
+ first_holding = holdings.first
129
+ assert_instance_of(Exlibris::Primo::Holding, first_holding, "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
130
+ assert_equal("check_holdings", first_holding.status, "#{searcher.class} first holding has an unexpected status: #{first_holding.status}")
131
+ assert_equal("NYU", first_holding.institution, "#{searcher.class} first holding has an unexpected institution: #{first_holding.institution}")
132
+ assert_equal("BOBST", first_holding.library, "#{searcher.class} first holding has an unexpected library: #{first_holding.library}")
133
+ assert_equal("Main Collection", first_holding.collection, "#{searcher.class} first holding has an unexpected collection: #{first_holding.collection}")
134
+ assert_equal("(PR6013.R44 T7 2004 )", first_holding.call_number, "#{searcher.class} first holding has an unexpected call number: #{first_holding.call_number}")
135
+ end
129
136
  end
130
137
 
131
138
  # Test search by isbn.
132
- test "search_by_isbn" do
133
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:isbn => @primo_test_isbn})
134
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
135
- search_results = searcher.response
136
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
137
- search_results.search("//search/isbn") do |isbn|
138
- assert_not_nil(isbn.inner_text.match(@primo_test_isbn), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
139
+ def testsearch_by_isbn
140
+ VCR.use_cassette('searcher search by isbn') do
141
+ searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:isbn => @primo_test_isbn})
142
+ assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
143
+ search_results = searcher.response
144
+ assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
145
+ search_results.search("//search/isbn") do |isbn|
146
+ assert_not_nil(isbn.inner_text.match(@primo_test_isbn), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
147
+ end
148
+ assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for ISBN: #{@primo_test_isbn}.")
139
149
  end
140
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for ISBN: #{@primo_test_isbn}.")
141
150
  end
142
151
 
143
152
  # Test search by isbn.
144
- test "search_by_issn" do
145
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup_without_config, {:issn => "0002-8614"})
146
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
147
- search_results = searcher.response
148
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
149
- search_results.search("//search/issn") do |isbn|
150
- assert_not_nil(isbn.inner_text.match("0002-8614"), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
153
+ def testsearch_by_issn
154
+ VCR.use_cassette('searcher search by issn') do
155
+ searcher = Exlibris::Primo::Searcher.new(@searcher_setup_without_config, {:issn => "0002-8614"})
156
+ assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
157
+ search_results = searcher.response
158
+ assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
159
+ search_results.search("//search/issn") do |isbn|
160
+ assert_not_nil(isbn.inner_text.match("0002-8614"), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
161
+ end
162
+ assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for ISSN: 0002-8614.")
151
163
  end
152
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for ISSN: 0002-8614.")
153
164
  end
154
165
 
155
166
  # Test search by title/author/genre.
156
- test "search_by_title_author_genre" do
157
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:title => @primo_test_title, :author => @primo_test_author, :genre => @primo_test_genre})
158
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
159
- search_results = searcher.response
160
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
161
- search_results.search("//search/title") do |title|
162
- assert_not_nil(title.inner_text.downcase.match(@primo_test_title.downcase), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
167
+ def testsearch_by_title_author_genre
168
+ VCR.use_cassette('searcher search by title author genre') do
169
+ searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:title => @primo_test_title, :author => @primo_test_author, :genre => @primo_test_genre})
170
+ assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
171
+ search_results = searcher.response
172
+ assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
173
+ search_results.search("//search/title") do |title|
174
+ assert_not_nil(title.inner_text.downcase.match(@primo_test_title.downcase), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
175
+ end
176
+ assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for Title: #{@primo_test_title}.")
163
177
  end
164
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for Title: #{@primo_test_title}.")
165
178
  end
166
179
 
167
180
  # Test search for a single Primo document w/ holdings.
168
- test "holdings" do
169
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
170
- holdings = searcher.holdings
171
- assert_instance_of(Array, holdings,
172
- "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
173
- assert_equal(1, holdings.count,
174
- "#{searcher.class} returned 0 holdings for doc id: #{@primo_holdings_doc_id}.")
175
- first_holding = holdings.first
176
- assert_instance_of(
177
- Exlibris::Primo::Holding,
178
- first_holding,
179
- "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
180
- test_data = {
181
- :record_id => "nyu_aleph000062856",
182
- :title => "Travels with my aunt",
183
- :author => "Graham Greene 1904-1991.",
184
- :source_id => "nyu_aleph",
185
- :original_source_id => "NYU01",
186
- :source_record_id => "000062856",
187
- :institution_code => "NYU",
188
- :institution => "NYU",
189
- :library_code => "BOBST",
190
- :library => "BOBST",
191
- :status_code => "check_holdings",
192
- :status => "check_holdings",
193
- :id_one => "Main Collection",
194
- :id_two => "(PR6013.R44 T7 2004 )",
195
- :collection => "Main Collection",
196
- :call_number => "(PR6013.R44 T7 2004 )",
197
- :origin => nil,
198
- :display_type => "book",
199
- :coverage => [],
200
- :notes => "",
201
- :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=nyu_aleph000062856&institution=NYU&vid=#{@vid}",
202
- :request_url => nil }
203
- test_data.each { |key, value|
204
- assert_equal(
205
- value,
206
- first_holding.send(key),
207
- "#{searcher.class} first holding has an unexpected #{key}: #{first_holding.send(key)}")
208
- }
181
+ def testholdings
182
+ VCR.use_cassette('searcher holdings by id') do
183
+ searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
184
+ holdings = searcher.holdings
185
+ assert_instance_of(Array, holdings,
186
+ "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
187
+ assert_equal(1, holdings.count,
188
+ "#{searcher.class} returned 0 holdings for doc id: #{@primo_holdings_doc_id}.")
189
+ first_holding = holdings.first
190
+ assert_instance_of(
191
+ Exlibris::Primo::Holding,
192
+ first_holding,
193
+ "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
194
+ test_data = {
195
+ :record_id => "nyu_aleph000062856",
196
+ :title => "Travels with my aunt",
197
+ :author => "Graham Greene 1904-1991.",
198
+ :source_id => "nyu_aleph",
199
+ :original_source_id => "NYU01",
200
+ :source_record_id => "000062856",
201
+ :institution_code => "NYU",
202
+ :institution => "NYU",
203
+ :library_code => "BOBST",
204
+ :library => "BOBST",
205
+ :status_code => "check_holdings",
206
+ :status => "check_holdings",
207
+ :id_one => "Main Collection",
208
+ :id_two => "(PR6013.R44 T7 2004 )",
209
+ :collection => "Main Collection",
210
+ :call_number => "(PR6013.R44 T7 2004 )",
211
+ :origin => nil,
212
+ :display_type => "book",
213
+ :coverage => [],
214
+ :notes => "",
215
+ :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=nyu_aleph000062856&institution=NYU&vid=#{@vid}",
216
+ :request_url => nil }
217
+ test_data.each { |key, value|
218
+ assert_equal(
219
+ value,
220
+ first_holding.send(key),
221
+ "#{searcher.class} first holding has an unexpected #{key}: #{first_holding.send(key)}")
222
+ }
223
+ end
209
224
  end
210
225
 
211
226
  # Test search for a single Primo document w/ rsrcs.
212
- test "rsrcs" do
213
- searcher = Exlibris::Primo::Searcher.new(
214
- @searcher_setup,
215
- { :primo_id => @primo_rsrcs_doc_id })
216
- rsrcs = searcher.rsrcs
217
- assert_instance_of(Array, rsrcs,
218
- "#{searcher.class} rsrcs is an unexpected object: #{rsrcs.class}")
219
- assert_equal(2, rsrcs.count,
220
- "#{searcher.class} returned an unexpected amount of rsrcs (#{rsrcs.count}) for doc id: #{@primo_rsrcs_doc_id}.")
221
- first_rsrc = rsrcs.first
222
- assert_instance_of(
223
- Exlibris::Primo::Rsrc,
224
- first_rsrc,
225
- "#{searcher.class} first rsrc is an unexpected object: #{first_rsrc.class}")
226
- test_data = {
227
- :record_id => "nyu_aleph002895625",
228
- :v => nil,
229
- :url => "https://ezproxy.library.nyu.edu/login?url=http://mq.oxfordjournals.org/",
230
- :display => "Online Version",
231
- :institution_code => "NYU",
232
- :origin => nil,
233
- :notes => "" }
234
- test_data.each { |key, value|
235
- assert_equal(
236
- value,
237
- first_rsrc.send(key),
238
- "#{searcher.class} first rsrc has an unexpected #{key}: #{first_rsrc.send(key)}")
239
- }
227
+ def testrsrcs
228
+ VCR.use_cassette('searcher rsrcs by id') do
229
+ searcher = Exlibris::Primo::Searcher.new(
230
+ @searcher_setup,
231
+ { :primo_id => @primo_rsrcs_doc_id })
232
+ rsrcs = searcher.rsrcs
233
+ assert_instance_of(Array, rsrcs,
234
+ "#{searcher.class} rsrcs is an unexpected object: #{rsrcs.class}")
235
+ assert_equal(2, rsrcs.count,
236
+ "#{searcher.class} returned an unexpected amount of rsrcs (#{rsrcs.count}) for doc id: #{@primo_rsrcs_doc_id}.")
237
+ first_rsrc = rsrcs.first
238
+ assert_instance_of(
239
+ Exlibris::Primo::Rsrc,
240
+ first_rsrc,
241
+ "#{searcher.class} first rsrc is an unexpected object: #{first_rsrc.class}")
242
+ test_data = {
243
+ :record_id => "nyu_aleph002895625",
244
+ :v => nil,
245
+ :url => "https://ezproxy.library.nyu.edu/login?url=http://mq.oxfordjournals.org/",
246
+ :display => "Online Version",
247
+ :institution_code => "NYU",
248
+ :origin => nil,
249
+ :notes => "" }
250
+ test_data.each { |key, value|
251
+ assert_equal(
252
+ value,
253
+ first_rsrc.send(key),
254
+ "#{searcher.class} first rsrc has an unexpected #{key}: #{first_rsrc.send(key)}")
255
+ }
256
+ end
240
257
  end
241
258
 
242
259
  # Test search for a single Primo document w/ tocs.
243
- test "tocs" do
244
- searcher = Exlibris::Primo::Searcher.new(
245
- @searcher_setup,
246
- { :primo_id => @primo_tocs_doc_id })
247
- tocs = searcher.tocs
248
- assert_instance_of(Array, tocs,
249
- "#{searcher.class} tocs is an unexpected object: #{tocs.class}")
250
- assert_equal(1, tocs.count,
251
- "#{searcher.class} returned an unexpected amount of tocs (#{tocs.count}) for doc id: #{@primo_tocs_doc_id}.")
252
- first_toc = tocs.last
253
- assert_instance_of(
254
- Exlibris::Primo::Toc,
255
- first_toc,
256
- "#{searcher.class} first toc is an unexpected object: #{first_toc.class}")
257
- test_data = {
258
- :record_id => "nyu_aleph003149772",
259
- :url => "http://www.loc.gov/catdir/toc/onix07/2001024342.html",
260
- :display => "Table of Contents",
261
- :notes => "" }
262
- test_data.each { |key, value|
263
- assert_equal(
264
- value,
265
- first_toc.send(key),
266
- "#{searcher.class} first toc has an unexpected #{key}: #{first_toc.send(key)}")
267
- }
260
+ def testtocs
261
+ VCR.use_cassette('searcher tocs by id') do
262
+ searcher = Exlibris::Primo::Searcher.new(
263
+ @searcher_setup,
264
+ { :primo_id => @primo_tocs_doc_id })
265
+ tocs = searcher.tocs
266
+ assert_instance_of(Array, tocs,
267
+ "#{searcher.class} tocs is an unexpected object: #{tocs.class}")
268
+ assert_equal(1, tocs.count,
269
+ "#{searcher.class} returned an unexpected amount of tocs (#{tocs.count}) for doc id: #{@primo_tocs_doc_id}.")
270
+ first_toc = tocs.last
271
+ assert_instance_of(
272
+ Exlibris::Primo::Toc,
273
+ first_toc,
274
+ "#{searcher.class} first toc is an unexpected object: #{first_toc.class}")
275
+ test_data = {
276
+ :record_id => "nyu_aleph003149772",
277
+ :url => "http://www.loc.gov/catdir/toc/onix07/2001024342.html",
278
+ :display => "Table of Contents",
279
+ :notes => "" }
280
+ test_data.each { |key, value|
281
+ assert_equal(
282
+ value,
283
+ first_toc.send(key),
284
+ "#{searcher.class} first toc has an unexpected #{key}: #{first_toc.send(key)}")
285
+ }
286
+ end
268
287
  end
269
288
 
270
- test "dedupmrg" do
271
- searcher = Exlibris::Primo::Searcher.new(
272
- @searcher_setup,
273
- { :primo_id => @primo_dedupmrg_doc_id })
274
- holdings = searcher.holdings
275
- assert_instance_of(Array, holdings,
276
- "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
277
- assert_equal(6, holdings.count,
278
- "#{searcher.class} returned 0 holdings for doc id: #{@primo_dedupmrg_doc_id}.")
279
- first_holding = holdings.first
280
- assert_instance_of(
281
- Exlibris::Primo::Holding,
282
- first_holding,
283
- "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
284
- test_data = {
285
- :record_id => "dedupmrg17343091",
286
- :title => "The New York times",
287
- :author => "",
288
- :source_id => "nyu_aleph",
289
- :original_source_id => "NYU01",
290
- :source_record_id => "000932393",
291
- :institution_code => "NYU",
292
- :institution => "NYU",
293
- :library_code => "BWEB",
294
- :library => "BWEB",
295
- :status_code => "check_holdings",
296
- :status => "check_holdings",
297
- :id_one => "Internet Resources",
298
- :id_two => "(Newspaper Electronic access )",
299
- :collection => "Internet Resources",
300
- :call_number => "(Newspaper Electronic access )",
301
- :origin => "nyu_aleph000932393",
302
- :display_type => "journal",
303
- :coverage => [],
304
- :notes => "",
305
- :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=dedupmrg17343091&institution=NYU&vid=#{@vid}",
306
- :request_url => nil }
307
- test_data.each { |key, value|
289
+ def testdedupmrg
290
+ VCR.use_cassette('searcher dedupmrg by id') do
291
+ searcher = Exlibris::Primo::Searcher.new(
292
+ @searcher_setup,
293
+ { :primo_id => @primo_dedupmrg_doc_id })
294
+ holdings = searcher.holdings
295
+ assert_instance_of(Array, holdings,
296
+ "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
297
+ assert_equal(7, holdings.count,
298
+ "#{searcher.class} returned 0 holdings for doc id: #{@primo_dedupmrg_doc_id}.")
299
+ first_holding = holdings.first
300
+ assert_instance_of(
301
+ Exlibris::Primo::Holding,
302
+ first_holding,
303
+ "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
304
+ test_data = {
305
+ :record_id => "dedupmrg17343091",
306
+ :title => "The New York times",
307
+ :author => "",
308
+ :source_id => "nyu_aleph",
309
+ :original_source_id => "NYU01",
310
+ :source_record_id => "000932393",
311
+ :institution_code => "NYU",
312
+ :institution => "NYU",
313
+ :library_code => "BWEB",
314
+ :library => "BWEB",
315
+ :status_code => "check_holdings",
316
+ :status => "check_holdings",
317
+ :id_one => "Internet Resources",
318
+ :id_two => "(Newspaper Electronic access )",
319
+ :collection => "Internet Resources",
320
+ :call_number => "(Newspaper Electronic access )",
321
+ :origin => "nyu_aleph000932393",
322
+ :display_type => "journal",
323
+ :coverage => [],
324
+ :notes => "",
325
+ :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=dedupmrg17343091&institution=NYU&vid=#{@vid}",
326
+ :request_url => nil }
327
+ test_data.each { |key, value|
328
+ assert_equal(
329
+ value,
330
+ first_holding.send(key),
331
+ "#{searcher.class} first holding has an unexpected #{key}: #{first_holding.send(key)}")
332
+ }
333
+ rsrcs = searcher.rsrcs
334
+ assert_instance_of(Array, rsrcs,
335
+ "#{searcher.class} rsrcs is an unexpected object: #{rsrcs.class}")
336
+ assert_equal(8, rsrcs.count,
337
+ "#{searcher.class} returned an unexpected amount of rsrcs (#{rsrcs.count}) for doc id: #{@primo_rsrcs_doc_id}.")
338
+ first_rsrc = rsrcs.first
339
+ assert_instance_of(
340
+ Exlibris::Primo::Rsrc,
341
+ first_rsrc,
342
+ "#{searcher.class} first rsrc is an unexpected object: #{first_rsrc.class}")
343
+ test_data = {
344
+ :record_id => "dedupmrg17343091",
345
+ :v => "",
346
+ :url => "https://ezproxy.library.nyu.edu/login?url=http://proquest.umi.com/pqdweb?RQT=318&VName=PQD&clientid=9269&pmid=7818",
347
+ :display => "1995 - Current Access via Proquest",
348
+ :institution_code => "NYU",
349
+ :origin => "nyu_aleph000932393",
350
+ :notes => "" }
351
+ test_data.each { |key, value|
352
+ assert_equal(
353
+ value,
354
+ first_rsrc.send(key),
355
+ "#{searcher.class} first rsrc has an unexpected #{key}: #{first_rsrc.send(key)}")
356
+ }
357
+ end
358
+ end
359
+
360
+ def testholdings_diacritics1
361
+ VCR.use_cassette('searcher diacritics1 by id') do
362
+ searcher = Exlibris::Primo::Searcher.new(
363
+ @searcher_setup,
364
+ { :primo_id => @primo_test_diacritics1_doc_id })
308
365
  assert_equal(
309
- value,
310
- first_holding.send(key),
311
- "#{searcher.class} first holding has an unexpected #{key}: #{first_holding.send(key)}")
312
- }
313
- rsrcs = searcher.rsrcs
314
- assert_instance_of(Array, rsrcs,
315
- "#{searcher.class} rsrcs is an unexpected object: #{rsrcs.class}")
316
- assert_equal(8, rsrcs.count,
317
- "#{searcher.class} returned an unexpected amount of rsrcs (#{rsrcs.count}) for doc id: #{@primo_rsrcs_doc_id}.")
318
- first_rsrc = rsrcs.first
319
- assert_instance_of(
320
- Exlibris::Primo::Rsrc,
321
- first_rsrc,
322
- "#{searcher.class} first rsrc is an unexpected object: #{first_rsrc.class}")
323
- test_data = {
324
- :record_id => "dedupmrg17343091",
325
- :v => "",
326
- :url => "https://ezproxy.library.nyu.edu/login?url=http://proquest.umi.com/pqdweb?RQT=318&VName=PQD&clientid=9269&pmid=7818",
327
- :display => "1995 - Current Access via Proquest",
328
- :institution_code => "NYU",
329
- :origin => "nyu_aleph000932393",
330
- :notes => "" }
331
- test_data.each { |key, value|
366
+ "Rubāʻīyāt-i Bābā Ṭāhir",
367
+ searcher.btitle,
368
+ "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
332
369
  assert_equal(
333
- value,
334
- first_rsrc.send(key),
335
- "#{searcher.class} first rsrc has an unexpected #{key}: #{first_rsrc.send(key)}")
336
- }
370
+ "Bābā-Ṭāhir, 11th cent",
371
+ searcher.au,
372
+ "#{searcher.class} has an unexpected author: #{searcher.au}")
373
+ end
337
374
  end
338
-
339
- test "holdings_diacritics1" do
340
- searcher = Exlibris::Primo::Searcher.new(
341
- @searcher_setup,
342
- { :primo_id => @primo_test_diacritics1_doc_id })
343
- assert_equal(
344
- "Rubāʻīyāt-i Bābā Ṭāhir",
345
- searcher.btitle,
346
- "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
347
- assert_equal(
348
- "Bābā-Ṭāhir, 11th cent",
349
- searcher.au,
350
- "#{searcher.class} has an unexpected author: #{searcher.au}")
351
- end
352
375
 
353
376
  # This test fails but I don't know why!
354
- # test "holdings_diacritics2" do
377
+ # def testholdings_diacritics2
355
378
  # searcher = Exlibris::Primo::Searcher.new(
356
379
  # @searcher_setup,
357
380
  # { :primo_id => @primo_test_diacritics2_doc_id })
@@ -365,17 +388,19 @@ class SearcherTest < ActiveSupport::TestCase
365
388
  # "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
366
389
  # end
367
390
 
368
- test "holdings_diacritics3" do
369
- searcher = Exlibris::Primo::Searcher.new(
370
- @searcher_setup,
371
- { :primo_id => @primo_test_diacritics3_doc_id })
372
- assert_equal(
373
- "Mul har ha-gaʻash : ḥoḳre toldot Yiśraʼel le-nokhaḥ ha-Shoʼah",
374
- searcher.btitle,
375
- "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
376
- assert_equal(
377
- "Engel, David",
378
- searcher.au,
379
- "#{searcher.class} has an unexpected author: #{searcher.au}")
391
+ def testholdings_diacritics3
392
+ VCR.use_cassette('searcher diacritics2 by id') do
393
+ searcher = Exlibris::Primo::Searcher.new(
394
+ @searcher_setup,
395
+ { :primo_id => @primo_test_diacritics3_doc_id })
396
+ assert_equal(
397
+ "Mul har ha-gaʻash : ḥoḳre toldot Yiśraʼel le-nokhaḥ ha-Shoʼah",
398
+ searcher.btitle,
399
+ "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
400
+ assert_equal(
401
+ "Engel, David",
402
+ searcher.au,
403
+ "#{searcher.class} has an unexpected author: #{searcher.au}")
404
+ end
380
405
  end
381
406
  end