exlibris-primo 0.0.2 → 0.0.3

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.
@@ -1,5 +1,5 @@
1
1
  require 'test_helper'
2
- class SearcherTest < Test::Unit::TestCase
2
+ class SearcherTest < ActiveSupport::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
 
@@ -1,5 +1,6 @@
1
+ # encoding: utf-8
1
2
  require 'test_helper'
2
- class SearcherTest < Test::Unit::TestCase
3
+ class SearcherTest < ActiveSupport::TestCase
3
4
  PNX_NS = {'pnx' => 'http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib'}
4
5
  SEARCH_NS = {'search' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
5
6
 
@@ -60,7 +61,7 @@ class SearcherTest < Test::Unit::TestCase
60
61
  end
61
62
 
62
63
  # Test search for a single Primo document.
63
- def test_search_by_doc_id
64
+ test "search_by_doc_id" do
64
65
  searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
65
66
  assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
66
67
  search_results = searcher.response
@@ -70,7 +71,7 @@ class SearcherTest < Test::Unit::TestCase
70
71
  end
71
72
 
72
73
  # Test search for a Primo problem record
73
- def test_search_by_genre_discrepancy
74
+ test "search_by_genre_discrepancy" do
74
75
  searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_test_problem_doc_id})
75
76
  assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
76
77
  search_results = searcher.response
@@ -80,7 +81,7 @@ class SearcherTest < Test::Unit::TestCase
80
81
  assert_equal(1, searcher.holdings.length, "#{searcher.class} returned unexpected holdings")
81
82
  end
82
83
 
83
- def test_search_by_bug1361
84
+ test "search_by_bug1361" do
84
85
  searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_test_bug1361_id})
85
86
  assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
86
87
  search_results = searcher.response
@@ -92,28 +93,28 @@ class SearcherTest < Test::Unit::TestCase
92
93
  end
93
94
 
94
95
  # Test search for an invalid Primo document.
95
- def test_search_by_invalid_doc_id
96
+ test "search_by_invalid_doc_id" do
96
97
  assert_raise(RuntimeError) {
97
98
  searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_invalid_doc_id})
98
99
  }
99
100
  end
100
101
 
101
102
  # Test invalid setup.
102
- def test_search_by_invalid_setup1
103
+ test "search_by_invalid_setup1" do
103
104
  assert_raise(RuntimeError) {
104
105
  searcher = Exlibris::Primo::Searcher.new({}, {:primo_id => @primo_invalid_doc_id})
105
106
  }
106
107
  end
107
108
 
108
109
  # Test invalid setup.
109
- def test_search_by_invalid_setup2
110
+ test "search_by_invalid_setup2" do
110
111
  assert_raise(RuntimeError) {
111
112
  searcher = Exlibris::Primo::Searcher.new({:base_url => @base_url, :config => nil}, {:primo_id => @primo_invalid_doc_id})
112
113
  }
113
114
  end
114
115
 
115
116
  # Test base setup search for a single Primo document.
116
- def test_search_base_setup_record_id
117
+ test "search_base_setup_record_id" do
117
118
  searcher = Exlibris::Primo::Searcher.new({:base_url => @base_url, :institution => @institution}, {:primo_id => @primo_holdings_doc_id})
118
119
  holdings = searcher.holdings
119
120
  assert_instance_of(Array, holdings, "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
@@ -128,7 +129,7 @@ class SearcherTest < Test::Unit::TestCase
128
129
  end
129
130
 
130
131
  # Test search by isbn.
131
- def test_search_by_isbn
132
+ test "search_by_isbn" do
132
133
  searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:isbn => @primo_test_isbn})
133
134
  assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
134
135
  search_results = searcher.response
@@ -140,7 +141,7 @@ class SearcherTest < Test::Unit::TestCase
140
141
  end
141
142
 
142
143
  # Test search by isbn.
143
- def test_search_by_issn
144
+ test "search_by_issn" do
144
145
  searcher = Exlibris::Primo::Searcher.new(@searcher_setup_without_config, {:issn => "0002-8614"})
145
146
  assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
146
147
  search_results = searcher.response
@@ -152,7 +153,7 @@ class SearcherTest < Test::Unit::TestCase
152
153
  end
153
154
 
154
155
  # Test search by title/author/genre.
155
- def test_search_by_title_author_genre
156
+ test "search_by_title_author_genre" do
156
157
  searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:title => @primo_test_title, :author => @primo_test_author, :genre => @primo_test_genre})
157
158
  assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
158
159
  search_results = searcher.response
@@ -164,7 +165,7 @@ class SearcherTest < Test::Unit::TestCase
164
165
  end
165
166
 
166
167
  # Test search for a single Primo document w/ holdings.
167
- def test_holdings
168
+ test "holdings" do
168
169
  searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
169
170
  holdings = searcher.holdings
170
171
  assert_instance_of(Array, holdings,
@@ -178,6 +179,8 @@ class SearcherTest < Test::Unit::TestCase
178
179
  "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
179
180
  test_data = {
180
181
  :record_id => "nyu_aleph000062856",
182
+ :title => "Travels with my aunt",
183
+ :author => "Graham Greene 1904-1991.",
181
184
  :source_id => "nyu_aleph",
182
185
  :original_source_id => "NYU01",
183
186
  :source_record_id => "000062856",
@@ -206,7 +209,7 @@ class SearcherTest < Test::Unit::TestCase
206
209
  end
207
210
 
208
211
  # Test search for a single Primo document w/ rsrcs.
209
- def test_rsrcs
212
+ test "rsrcs" do
210
213
  searcher = Exlibris::Primo::Searcher.new(
211
214
  @searcher_setup,
212
215
  { :primo_id => @primo_rsrcs_doc_id })
@@ -237,7 +240,7 @@ class SearcherTest < Test::Unit::TestCase
237
240
  end
238
241
 
239
242
  # Test search for a single Primo document w/ tocs.
240
- def test_tocs
243
+ test "tocs" do
241
244
  searcher = Exlibris::Primo::Searcher.new(
242
245
  @searcher_setup,
243
246
  { :primo_id => @primo_tocs_doc_id })
@@ -264,7 +267,7 @@ class SearcherTest < Test::Unit::TestCase
264
267
  }
265
268
  end
266
269
 
267
- def test_dedupmrg
270
+ test "dedupmrg" do
268
271
  searcher = Exlibris::Primo::Searcher.new(
269
272
  @searcher_setup,
270
273
  { :primo_id => @primo_dedupmrg_doc_id })
@@ -280,6 +283,8 @@ class SearcherTest < Test::Unit::TestCase
280
283
  "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
281
284
  test_data = {
282
285
  :record_id => "dedupmrg17343091",
286
+ :title => "The New York times",
287
+ :author => "",
283
288
  :source_id => "nyu_aleph",
284
289
  :original_source_id => "NYU01",
285
290
  :source_record_id => "000932393",
@@ -331,53 +336,46 @@ class SearcherTest < Test::Unit::TestCase
331
336
  }
332
337
  end
333
338
 
334
- # def test_holdings_diacritics1
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
+
353
+ # This test fails but I don't know why!
354
+ # test "holdings_diacritics2" do
335
355
  # searcher = Exlibris::Primo::Searcher.new(
336
356
  # @searcher_setup,
337
- # { :primo_id => @primo_test_diacritics1_doc_id })
357
+ # { :primo_id => @primo_test_diacritics2_doc_id })
338
358
  # assert_equal(
339
- # "Rubāʻīyāt-i Bābā Ṭāhir",
340
- # searcher.btitle,
341
- # "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
342
- # assert_equal(
343
- # "Bābā-Ṭāhir, 11th cent",
359
+ # "Faraj, Faraj Maḥmūd",
344
360
  # searcher.au,
345
361
  # "#{searcher.class} has an unexpected author: #{searcher.au}")
362
+ # assert_equal(
363
+ # "Iqlīm Tuwāt khilāl al-qarnayn al-thāmin ʻashar wa-al-tāsiʻ ʻashar al-mīlādīyīn : dirāsah li-awḍāʻ al-iqlīm al-siyāsīyah wa-al-ijtimāʻīyah wa-al-iqtiṣādīyah wa-al-thaqāfīyah, maʻa taḥqīq kitāb al-Qawl al-basīṭ fī akhbār Tamanṭīṭ (li-Muḥammad ibn Bābā Ḥaydah)",
364
+ # searcher.btitle,
365
+ # "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
346
366
  # end
347
367
 
348
- # # This test fails but I don't know why!
349
- # def test_holdings_diacritics2
350
- # searcher = Exlibris::Primo::Searcher.new(
351
- # @searcher_setup,
352
- # { :primo_id => @primo_test_diacritics2_doc_id })
353
- # assert_equal(
354
- # "أقليم توات خلال القرنين الثامن عشر والتاسع عشر الميلاديين : دراسة لأوضاع الأقليم السياسية والأجتماعية والأقتصادية والثقافية، مع تحقيق كتاب القول البسيط في أخبار تمنطيط (لمحمد بن بابا حيده)",
355
- # searcher.btitle,
356
- # "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
357
- # puts ("\n")
358
- # puts searcher.au.bytes.collect.inspect
359
- # faraj = "Faraj, Faraj Maḥmūd"
360
- # puts ("\n»")
361
- # puts "»".bytes.collect.inspect
362
- # puts faraj.bytes.collect.inspect
363
- # assert_equal(
364
- # "Faraj, Faraj Maḥmūd",
365
- # searcher.au,
366
- # "#{searcher.class} has an unexpected author: #{searcher.au}")
367
- # assert_equal("(DT299.T88 F373 2007)", first_holding.call_number, "#{searcher.class} first holding has an unexpected call number: #{first_holding.call_number}")
368
- # end
369
- #
370
- # def test_holdings_diacritics3
371
- # searcher = Exlibris::Primo::Searcher.new(
372
- # @searcher_setup,
373
- # { :primo_id => @primo_test_diacritics3_doc_id })
374
- # assert_equal(
375
- # "Mul har ha-gaʻash : ḥoḳre toldot Yiśraʼel le-nokhaḥ ha-Shoʼah",
376
- # searcher.btitle,
377
- # "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
378
- # assert_equal(
379
- # "Engel, David",
380
- # searcher.au,
381
- # "#{searcher.class} has an unexpected author: #{searcher.au}")
382
- # end
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}")
380
+ end
383
381
  end
@@ -38,7 +38,7 @@ class WebServiceTest < ActiveSupport::TestCase
38
38
  @title_author_genre_search_params = {:title => "Travels with My Aunt", :author => "Graham Greene", :genre => "Book"}
39
39
  end
40
40
 
41
- def test_bogus_response
41
+ test "bogus_response" do
42
42
  assert_raise(SOAP::HTTPStreamError) {
43
43
  ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @bogus_404_url)
44
44
  }
@@ -48,7 +48,7 @@ class WebServiceTest < ActiveSupport::TestCase
48
48
  end
49
49
 
50
50
  # Test GetRecord for a single Primo document.
51
- def test_get_record
51
+ test "get_record" do
52
52
  ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @base_url)
53
53
  assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
54
54
  assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
@@ -56,17 +56,17 @@ class WebServiceTest < ActiveSupport::TestCase
56
56
  assert_equal(@primo_test_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
57
57
  end
58
58
 
59
- def test_count_get_record
59
+ test "get_record_count" do
60
60
  ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @base_url)
61
61
  assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
62
62
  end
63
63
 
64
- def test_count_search_brief
64
+ test "search_brief_count" do
65
65
  ws = Exlibris::Primo::WebService::SearchBrief.new(@isbn_search_params, @base_url)
66
66
  assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
67
67
  end
68
68
 
69
- def test_get_genre_discrepancy
69
+ test "get_genre_discrepancy" do
70
70
  ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_problem_doc_id, @base_url)
71
71
  assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
72
72
  assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
@@ -76,14 +76,14 @@ class WebServiceTest < ActiveSupport::TestCase
76
76
  end
77
77
 
78
78
  # Test GetRecord with invalid Primo doc id.
79
- def test_get_bogus_record
79
+ test "get_bogus_record" do
80
80
  assert_raise(RuntimeError) {
81
81
  ws = Exlibris::Primo::WebService::GetRecord.new(@primo_invalid_doc_id, @base_url)
82
82
  }
83
83
  end
84
84
 
85
85
  # Test SearchBrief by isbn.
86
- def test_isbn_search
86
+ test "isbn_search" do
87
87
  ws = Exlibris::Primo::WebService::SearchBrief.new(@isbn_search_params, @base_url)
88
88
  assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
89
89
  assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
@@ -91,7 +91,7 @@ class WebServiceTest < ActiveSupport::TestCase
91
91
  end
92
92
 
93
93
  # Test SearchBrief by issn.
94
- def test_issn_search
94
+ test "issn_search" do
95
95
  ws = Exlibris::Primo::WebService::SearchBrief.new(@issn_search_params, @base_url)
96
96
  assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
97
97
  assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
@@ -99,7 +99,7 @@ class WebServiceTest < ActiveSupport::TestCase
99
99
  end
100
100
 
101
101
  # Test SearchBrief by title.
102
- def test_title_search
102
+ test "title_search" do
103
103
  ws = Exlibris::Primo::WebService::SearchBrief.new(@title_search_params, @base_url)
104
104
  assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
105
105
  assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
@@ -107,7 +107,7 @@ class WebServiceTest < ActiveSupport::TestCase
107
107
  end
108
108
 
109
109
  # Test SearchBrief by author.
110
- def test_author_search
110
+ test "author_search" do
111
111
  ws = Exlibris::Primo::WebService::SearchBrief.new(@author_search_params, @base_url)
112
112
  assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
113
113
  assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
@@ -115,7 +115,7 @@ class WebServiceTest < ActiveSupport::TestCase
115
115
  end
116
116
 
117
117
  # Test SearchBrief by title/author/genre.
118
- def test_title_author_genre_search
118
+ test "title_author_genre_search" do
119
119
  ws = Exlibris::Primo::WebService::SearchBrief.new(@title_author_genre_search_params, @base_url)
120
120
  assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
121
121
  assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exlibris-primo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2160476020 !ruby/object:Gem::Requirement
16
+ requirement: &2156494220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160476020
24
+ version_requirements: *2156494220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &2160475540 !ruby/object:Gem::Requirement
27
+ requirement: &2156493760 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2160475540
35
+ version_requirements: *2156493760
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: soap4r-ruby1.9
38
- requirement: &2160474800 !ruby/object:Gem::Requirement
38
+ requirement: &2156493180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2160474800
46
+ version_requirements: *2156493180
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
- requirement: &2160473540 !ruby/object:Gem::Requirement
49
+ requirement: &2156492620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2160473540
57
+ version_requirements: *2156492620
58
58
  description: Library to work with Exlibris' Primo discovery system.
59
59
  email:
60
60
  - scotdalton@gmail.com