umlaut 3.0.0alpha10 → 3.0.0alpha11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/app/models/collection.rb +7 -1
  2. data/app/models/referent.rb +11 -77
  3. data/app/models/request.rb +2 -2
  4. data/app/models/service_store.rb +4 -0
  5. data/app/models/service_wave.rb +1 -1
  6. data/lib/section_renderer.rb +9 -5
  7. data/lib/service.rb +0 -62
  8. data/lib/service_adaptors/isi.rb +1 -1
  9. data/lib/service_adaptors/jcr.rb +1 -1
  10. data/lib/umlaut/version.rb +1 -1
  11. data/lib/umlaut_configurable.rb +1 -0
  12. data/test/dummy/config/environments/profile.rb +24 -0
  13. data/test/dummy/config/primo.yml +271 -0
  14. data/test/dummy/config/umlaut_services-TEST.yml +37 -0
  15. data/test/dummy/profile/sfx_collection_prof.rb +22 -0
  16. data/test/dummy/tmp/cache/assets/C2A/410/sprockets%2Fd654b74912b4773a2534616863fb6565 +0 -0
  17. data/test/dummy/tmp/cache/assets/C45/A30/sprockets%2F39494895e462697b478d3d0c79298a26 +0 -0
  18. data/test/dummy/tmp/cache/assets/C5F/340/sprockets%2F99692920160b7a279b86a80415b79db7 +0 -0
  19. data/test/dummy/tmp/cache/assets/C70/4D0/sprockets%2F034ad2036e623081bd352800786dfe80 +0 -0
  20. data/test/dummy/tmp/cache/assets/C80/980/sprockets%2Fc94807409c1523d43e18d25f35d93c41 +0 -0
  21. data/test/dummy/tmp/cache/assets/{D0E/570/sprockets%2Fd4a16e3bdd7c7b9543c446b1b0174688 → CBD/730/sprockets%2F034c1086748b981c36672d5a56e7fed6} +0 -0
  22. data/test/dummy/tmp/cache/assets/CBF/B60/sprockets%2F08ca89671549936265dcb673bf02e36f +0 -0
  23. data/test/dummy/tmp/cache/assets/CC9/9F0/sprockets%2F306166316e2cafd13c15e62b51a2339d +0 -0
  24. data/test/dummy/tmp/cache/assets/CD6/300/sprockets%2F397ec39d3d883789effe506c38760368 +0 -0
  25. data/test/dummy/tmp/cache/assets/CD7/DD0/sprockets%2F4f1fe68aa2042a0970bde9b185530646 +0 -0
  26. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  27. data/test/dummy/tmp/cache/assets/CF7/2B0/sprockets%2F25a7c73655bd3598173b39d9f98bcd46 +0 -0
  28. data/test/dummy/tmp/cache/assets/CFE/080/sprockets%2F37fe9f4255baddbd549a659914929398 +0 -0
  29. data/test/dummy/tmp/cache/assets/{CE1/F50/sprockets%2F6e6b593b107866863500ba0fee5a9e24 → D16/F90/sprockets%2F5fe3c021048c6f9a6086bed7736d87b1} +0 -0
  30. data/test/dummy/tmp/cache/assets/{CDD/7D0/sprockets%2F60687bff4553a7f8c701bb9627a6200a → D24/360/sprockets%2F6987b047a96dc685ba3cf39b31477f6d} +0 -0
  31. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  32. data/test/dummy/tmp/cache/assets/D37/2B0/sprockets%2F40834fb07d7318c1fddd5003bd9e04f6 +0 -0
  33. data/test/dummy/tmp/cache/assets/D43/0D0/sprockets%2F682843a8d0795a5fbcfeb2f0c81727d0 +0 -0
  34. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  35. data/test/dummy/tmp/cache/assets/D50/A30/sprockets%2F7d8b294ac433db5d056538f8cf7c66b9 +0 -0
  36. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  37. data/test/dummy/tmp/cache/assets/D6C/7D0/sprockets%2F8a05d6981ec0d38c51739bef0b3a9c2b +0 -0
  38. data/test/dummy/tmp/cache/assets/D94/FF0/sprockets%2F3b56a1aa77de0d570c38a4a9d5f4b1d6 +0 -0
  39. data/test/dummy/tmp/cache/assets/D97/6B0/sprockets%2Fb070e8c799d1a4ad5e62e0a1ae3b83e6 +0 -0
  40. data/test/dummy/tmp/cache/assets/DA6/A80/sprockets%2F92e26d8e58d5bcc8b8f6c25d1b05b9c1 +0 -0
  41. data/test/dummy/tmp/cache/assets/{DB7/BD0/sprockets%2Ff2c59778ab79dcfd3792f46f2ce82f2a → DC0/D20/sprockets%2F1ccf7405cd252dcec4bf23af82e2563a} +0 -0
  42. data/test/dummy/tmp/cache/assets/{D5C/B00/sprockets%2F2b7ac06cc680d7480c06b917bac5a6b0 → DD2/D80/sprockets%2Fc66d103807d0f971fbbcf9aa8b8b27ee} +0 -0
  43. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  44. data/test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 +0 -0
  45. data/test/dummy/tmp/cache/assets/DF5/5E0/sprockets%2F8e64a37c73cdc0b37a4ccfcb42ab45d8 +0 -0
  46. data/test/dummy/tmp/cache/assets/DF7/960/sprockets%2F99ac6db10b44a64fbba4ee847b35ba8b +0 -0
  47. data/test/dummy/tmp/cache/assets/{C84/A00/sprockets%2F3ba04c88513936081d59d8771f6804aa → DFC/040/sprockets%2F15ea81cf915c0cb1dfc9cc04c9fef364} +0 -0
  48. data/test/dummy/tmp/cache/assets/DFD/300/sprockets%2Fabac9489cf7f1db8ef00d72a1571ee1e +0 -0
  49. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  50. data/test/dummy/tmp/cache/assets/E38/FE0/sprockets%2Fe1fc875efa817cbb94a5d8de25ea4e6b +0 -0
  51. data/test/dummy/tmp/cache/assets/E5F/960/sprockets%2Fdc007b6cad5c7ef08e33ec28cfff0ef6 +0 -0
  52. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_gc_runs.csv +2 -0
  53. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_gc_time.csv +2 -0
  54. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_memory.csv +2 -0
  55. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_objects.csv +2 -0
  56. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_wall_time.csv +2 -0
  57. data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_flat.txt +11 -0
  58. data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_graph.html +303 -0
  59. data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_stack.html +546 -0
  60. data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_tree.txt +38 -0
  61. data/test/dummy/tmp/performance/empty.png +0 -0
  62. data/test/dummy/tmp/performance/minus.png +0 -0
  63. data/test/dummy/tmp/performance/plus.png +0 -0
  64. data/test/test_helper.rb +36 -0
  65. data/test/unit/aleph_patron_test.rb +40 -35
  66. data/test/unit/aleph_record_benchmarks.rb +28 -24
  67. data/test/unit/aleph_record_test.rb +31 -26
  68. data/test/unit/collection_test.rb +17 -18
  69. data/test/unit/google_book_search_test.rb +18 -44
  70. data/test/unit/primo_searcher_test.rb +325 -321
  71. data/test/unit/primo_service_test.rb +924 -919
  72. data/test/unit/primo_ws_test.rb +141 -138
  73. data/test/unit/service_test.rb +2 -16
  74. metadata +93 -100
  75. data/test/dummy/tmp/cache/assets/C73/920/sprockets%2Fd371318f22900492fd180f17c5e2a504 +0 -0
  76. data/test/dummy/tmp/cache/assets/C8F/780/sprockets%2Fe47e28558116fb5f8038754e60d1961d +0 -0
  77. data/test/dummy/tmp/cache/assets/CAA/EB0/sprockets%2F1d179210e8b76f1ea63c802688a015e4 +0 -9271
  78. data/test/dummy/tmp/cache/assets/CB2/DA0/sprockets%2Fa1808990b72376256db2ae3818c0e9b5 +0 -0
  79. data/test/dummy/tmp/cache/assets/CBB/9C0/sprockets%2F706f28923fb754cad04b9107c89986a1 +0 -0
  80. data/test/dummy/tmp/cache/assets/CDC/680/sprockets%2F2b68ef632d12610f3c9563168bfa7c05 +0 -0
  81. data/test/dummy/tmp/cache/assets/CEA/2A0/sprockets%2F9c8607157b998108ce08f4aca39f810a +0 -0
  82. data/test/dummy/tmp/cache/assets/CF5/9B0/sprockets%2F7933bfe880731b396791f1682ce3f7fa +0 -0
  83. data/test/dummy/tmp/cache/assets/CFB/2F0/sprockets%2F62d51f0aa5cac4b1cf7091823772a604 +0 -0
  84. data/test/dummy/tmp/cache/assets/D22/060/sprockets%2F9aec77b768e91a802d284271c58e2f7e +0 -0
  85. data/test/dummy/tmp/cache/assets/D33/6D0/sprockets%2F500129c57f1146e556ec3aacd6cd38c1 +0 -0
  86. data/test/dummy/tmp/cache/assets/D33/FD0/sprockets%2F2ba0b4e6334a77b923e5f770381bb2bf +0 -0
  87. data/test/dummy/tmp/cache/assets/D4C/0A0/sprockets%2F7810d837eec3ac57ad78756af83a6a55 +0 -0
  88. data/test/dummy/tmp/cache/assets/D4C/E30/sprockets%2F631abf89746799b7a5b2b3b4f6294bcd +0 -0
  89. data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -873
  90. data/test/dummy/tmp/cache/assets/D5D/AD0/sprockets%2Fbdb053d9a6a967788f09fbc555d69f58 +0 -0
  91. data/test/dummy/tmp/cache/assets/D66/890/sprockets%2F06287a78ed20d8214197eab03bfca5dd +0 -0
  92. data/test/dummy/tmp/cache/assets/D6B/2A0/sprockets%2F81f17ab0ed20f4a8d9355f7a1d872eb2 +0 -0
  93. data/test/dummy/tmp/cache/assets/D70/080/sprockets%2F24d3ce40ae5cc827a9183b1fb837e84e +0 -0
  94. data/test/dummy/tmp/cache/assets/D71/6B0/sprockets%2Fde558b71b494cf09b1bf055c8dff0353 +0 -0
  95. data/test/dummy/tmp/cache/assets/D72/610/sprockets%2Fa8c708eeb30ef93de34d755d4f45d023 +0 -0
  96. data/test/dummy/tmp/cache/assets/D74/4C0/sprockets%2F64fdf30f75592d6e45fcfc45a48d20a2 +0 -0
  97. data/test/dummy/tmp/cache/assets/D76/AD0/sprockets%2Fe2158cde93188cf5ab6457bc6d6602ec +0 -0
  98. data/test/dummy/tmp/cache/assets/D7A/E40/sprockets%2F9622ffcc499a57627cd1bb18fe31b8e4 +0 -11772
  99. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  100. data/test/dummy/tmp/cache/assets/D9B/770/sprockets%2F8aacf02eb7dbb0949704b28f27b87e0b +0 -0
  101. data/test/dummy/tmp/cache/assets/DF7/F30/sprockets%2F7bc16c4109b17fabe29f8ddbbf732d1c +0 -0
  102. data/test/dummy/tmp/cache/assets/E03/570/sprockets%2F493bdc0ac14cd4f57fdfe4253f992bde +0 -0
  103. data/test/dummy/tmp/cache/assets/E09/850/sprockets%2F4bf497a38ecfef660b2f0ebb852d5e9c +0 -0
  104. data/test/dummy/tmp/cache/assets/E0B/4B0/sprockets%2F7988df51a61c81ce6ede4a2d4c8cce4f +0 -377
  105. data/test/dummy/tmp/cache/assets/E6F/A00/sprockets%2Fd32bcea45ea04a6aaee95b3aa840cbab +0 -0
@@ -1,39 +1,44 @@
1
1
  require 'test_helper'
2
2
  class AlephPatronTest < Test::Unit::TestCase
3
- def setup
4
- @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
5
- @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
6
- @rest_url = @nyu_aleph_config["rest_url"]
7
- @aleph_doc_library = "NYU01"
8
- @aleph_doc_number = "000062856"
9
- @nyuidn = "N12162279"
10
- @aleph_adm_library = "NYU50"
11
- @aleph_item_id = "NYU50000062856000010"
12
- @aleph_renew_item_id = "NYU50000647049"
13
- @pickup_location = "BOBST"
14
- @bogus_url = "http://library.nyu.edu/bogus"
15
- end
16
-
17
- # Test exception handling for bogus response.
18
- def test_bogus_response
19
- patron = Exlibris::Aleph::Patron.new(@nyuidn, @bogus_url)
20
- assert_raise(MultiXml::ParseError) { patron.loans }
21
- assert_raise(MultiXml::ParseError) { patron.renew_loans() }
22
- assert_raise(MultiXml::ParseError) { patron.renew_loans(@aleph_renew_item_id) }
23
- assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location}) }
24
- end
25
-
26
- # Test search for a single Primo document.
27
- def test_patron
28
- patron = Exlibris::Aleph::Patron.new(@nyuidn, @rest_url)
29
- loans = patron.loans
30
- assert_nil(patron.error, "Failure in #{patron.class} while getting loans: #{patron.error}")
31
- #renew_loans = patron.renew_loans()
32
- #assert_nil(patron.error, "Failure in #{patron.class} while renewing all loans: #{patron.error}")
33
- #renew_loans = patron.renew_loans(@aleph_renew_item_id)
34
- #assert_nil(patron.error, "Failure in #{patron.class} while renewing loan #{@aleph_renew_item_id}: #{patron.error}")
35
- assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {}) }
36
- place_hold = patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location})
37
- assert_nil(patron.error, "Failure in #{patron.class} while placing hold: #{patron.error}")
3
+
4
+ nyu_only_tests(self.name) do
5
+
6
+ def setup
7
+ @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
8
+ @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
9
+ @rest_url = @nyu_aleph_config["rest_url"]
10
+ @aleph_doc_library = "NYU01"
11
+ @aleph_doc_number = "000062856"
12
+ @nyuidn = "N12162279"
13
+ @aleph_adm_library = "NYU50"
14
+ @aleph_item_id = "NYU50000062856000010"
15
+ @aleph_renew_item_id = "NYU50000647049"
16
+ @pickup_location = "BOBST"
17
+ @bogus_url = "http://library.nyu.edu/bogus"
18
+ end
19
+
20
+ # Test exception handling for bogus response.
21
+ def test_bogus_response
22
+ patron = Exlibris::Aleph::Patron.new(@nyuidn, @bogus_url)
23
+ assert_raise(MultiXml::ParseError) { patron.loans }
24
+ assert_raise(MultiXml::ParseError) { patron.renew_loans() }
25
+ assert_raise(MultiXml::ParseError) { patron.renew_loans(@aleph_renew_item_id) }
26
+ assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location}) }
27
+ end
28
+
29
+ # Test search for a single Primo document.
30
+ def test_patron
31
+ patron = Exlibris::Aleph::Patron.new(@nyuidn, @rest_url)
32
+ loans = patron.loans
33
+ assert_nil(patron.error, "Failure in #{patron.class} while getting loans: #{patron.error}")
34
+ #renew_loans = patron.renew_loans()
35
+ #assert_nil(patron.error, "Failure in #{patron.class} while renewing all loans: #{patron.error}")
36
+ #renew_loans = patron.renew_loans(@aleph_renew_item_id)
37
+ #assert_nil(patron.error, "Failure in #{patron.class} while renewing loan #{@aleph_renew_item_id}: #{patron.error}")
38
+ assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {}) }
39
+ place_hold = patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location})
40
+ assert_nil(patron.error, "Failure in #{patron.class} while placing hold: #{patron.error}")
41
+ end
42
+
38
43
  end
39
44
  end
@@ -1,28 +1,32 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper'
2
- class AlephRecordBenchMarks < Test::Unit::TestCase
3
- def setup
4
- @primo_config = YAML.load_file("#{Rails.root}/config/umlaut_config/primo.yml")
5
- @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
6
- @rest_url = @nyu_aleph_config["rest_url"]
7
- @aleph_doc_library = "NYU01"
8
- @aleph_doc_number = "000062856"
9
- @bogus_url = "http://library.nyu.edu/bogus"
10
- @TESTS = 10
11
- end
12
-
13
- # Get benchmarks for calls to the Aleph API.
14
- def test_benchmarks
15
- # Display performance benchmarks.
16
- time = Benchmark.bmbm do |results|
17
- results.report("Aleph items:") { @TESTS.times {
18
- aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
19
- items = aleph_record.items
20
- } }
21
- results.report("Aleph bib and holdings:") { @TESTS.times {
22
- aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
23
- items = aleph_record.bib
24
- items = aleph_record.holdings
25
- } }
2
+ class AlephRecordBenchMarks < Test::Unit::TestCase
3
+ nyu_only_tests(self.name) do
4
+
5
+ def setup
6
+ @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
7
+ @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
8
+ @rest_url = @nyu_aleph_config["rest_url"]
9
+ @aleph_doc_library = "NYU01"
10
+ @aleph_doc_number = "000062856"
11
+ @bogus_url = "http://library.nyu.edu/bogus"
12
+ @TESTS = 10
13
+ end
14
+
15
+ # Get benchmarks for calls to the Aleph API.
16
+ def test_benchmarks
17
+ # Display performance benchmarks.
18
+ time = Benchmark.bmbm do |results|
19
+ results.report("Aleph items:") { @TESTS.times {
20
+ aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
21
+ items = aleph_record.items
22
+ } }
23
+ results.report("Aleph bib and holdings:") { @TESTS.times {
24
+ aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
25
+ items = aleph_record.bib
26
+ items = aleph_record.holdings
27
+ } }
28
+ end
26
29
  end
30
+
27
31
  end
28
32
  end
@@ -1,30 +1,35 @@
1
1
  require 'test_helper'
2
2
  class AlephRecordTest < Test::Unit::TestCase
3
- def setup
4
- @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
5
- @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
6
- @rest_url = @nyu_aleph_config["rest_url"]
7
- @aleph_doc_library = "NYU01"
8
- @aleph_doc_number = "000062856"
9
- @bogus_url = "http://library.nyu.edu/bogus"
10
- end
11
-
12
- # Test exception handling for bogus response.
13
- def test_bogus_response
14
- aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @bogus_url)
15
- assert_raise(RuntimeError) { aleph_record.bib }
16
- assert_raise(RuntimeError) { aleph_record.holdings }
17
- assert_raise(MultiXml::ParseError) { aleph_record.items }
18
- end
19
-
20
- # Test search for a single Primo document.
21
- def test_record
22
- aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
23
- bib = aleph_record.bib
24
- assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling bib: #{aleph_record.error}")
25
- holdings = aleph_record.holdings
26
- assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling holdings: #{aleph_record.error}")
27
- items = aleph_record.items
28
- assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling items: #{aleph_record.error}")
3
+
4
+ nyu_only_tests(self.name) do
5
+
6
+ def setup
7
+ @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
8
+ @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
9
+ @rest_url = @nyu_aleph_config["rest_url"]
10
+ @aleph_doc_library = "NYU01"
11
+ @aleph_doc_number = "000062856"
12
+ @bogus_url = "http://library.nyu.edu/bogus"
13
+ end
14
+
15
+
16
+ # Test exception handling for bogus response.
17
+ def test_bogus_response
18
+ aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @bogus_url)
19
+ assert_raise(RuntimeError) { aleph_record.bib }
20
+ assert_raise(RuntimeError) { aleph_record.holdings }
21
+ assert_raise(MultiXml::ParseError) { aleph_record.items }
22
+ end
23
+
24
+ # Test search for a single Primo document.
25
+ def test_record
26
+ aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
27
+ bib = aleph_record.bib
28
+ assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling bib: #{aleph_record.error}")
29
+ holdings = aleph_record.holdings
30
+ assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling holdings: #{aleph_record.error}")
31
+ items = aleph_record.items
32
+ assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling items: #{aleph_record.error}")
33
+ end
29
34
  end
30
35
  end
@@ -2,30 +2,29 @@ require File.dirname(__FILE__) + '/../test_helper'
2
2
 
3
3
  class CollectionTest < ActiveSupport::TestCase
4
4
  fixtures :requests, :referents, :referent_values, :sfx_urls
5
-
6
- def setup
7
- # Make something that looks like a session hash type thing, so we
8
- # can init a collection with it.
9
- @fake_session = Hash.new
10
- class << @fake_session
11
- def session_id ; "000001" ; end
12
- end
13
- end
14
-
15
5
 
6
+ def setup
7
+ # will get from ./config/services.yml. You want to test a different
8
+ # set of services? Have to set em in ServiceStore too, as in general
9
+ # things passed to new Collection are expected to be in ServiceStore
10
+ @services = ServiceStore.config["default"]["services"]
11
+ @request = requests(:simple_request)
12
+ end
13
+
16
14
  def test_collection_instantiate
17
- collection = Collection.new(requests(:simple_request) , @fake_session)
15
+ collection = Collection.new(@request , @services)
18
16
 
19
17
  new_services = collection.instantiate_services!
18
+
20
19
  assert_not_nil new_services
21
- assert new_services.length > 0
20
+ assert new_services.length > 0, "no services returned"
22
21
  new_services.each do |s|
23
22
  assert_kind_of Service, s
24
23
  end
25
24
  end
26
25
 
27
26
  def test_instantiate_creates_new
28
- collection = Collection.new(requests(:simple_request) , @fake_session)
27
+ collection = Collection.new(@request , @services)
29
28
 
30
29
  s1 = collection.instantiate_services!
31
30
  s2 = collection.instantiate_services!
@@ -35,7 +34,7 @@ class CollectionTest < ActiveSupport::TestCase
35
34
  end
36
35
 
37
36
  def test_service_level
38
- collection = Collection.new(requests(:simple_request) , @fake_session)
37
+ collection = Collection.new(@request , @services)
39
38
 
40
39
  services = collection.instantiate_services!(:level => 'c')
41
40
 
@@ -43,7 +42,7 @@ class CollectionTest < ActiveSupport::TestCase
43
42
  end
44
43
 
45
44
  def test_requests_set
46
- collection = Collection.new(requests(:simple_request) , @fake_session)
45
+ collection = Collection.new(@request , @services)
47
46
 
48
47
  services = collection.instantiate_services!(:level => 'c')
49
48
 
@@ -53,16 +52,16 @@ class CollectionTest < ActiveSupport::TestCase
53
52
  end
54
53
 
55
54
  def test_get_single_service
56
- collection = Collection.new(requests(:simple_request) , @fake_session)
55
+ collection = Collection.new(@request , @services)
57
56
 
58
- service = collection.instantiate_service!("UlrichsCover")
57
+ service = collection.instantiate_services!(:ids => ["UlrichsCover"]).first
59
58
 
60
59
  assert_not_nil service, "Service for UlrichsCover not returned"
61
60
  assert_not_nil service.request, "Service for UlrichsCover does not have request set."
62
61
  end
63
62
 
64
63
  def test_get_nonexisting_task
65
- collection = Collection.new(requests(:simple_request) , @fake_session)
64
+ collection = Collection.new(@request , @services)
66
65
 
67
66
  null_services = collection.instantiate_services!(:task => :no_such_task)
68
67
 
@@ -14,54 +14,23 @@ require 'rubygems'
14
14
 
15
15
  require 'yaml'
16
16
 
17
- class GoogleBookSearchTest < Test::Unit::TestCase
17
+ class GoogleBookSearchTest < ActiveSupport::TestCase
18
+ fixtures :requests, :referents
18
19
 
19
-
20
-
21
- def setup
22
-
23
-
24
- @gbs_default = ServiceList.instance.instantiate!("GoogleBookSearch", nil)
25
- @gbs_minimum = GoogleBookSearch.new({"priority"=>1})
20
+ def setup
21
+ @gbs_default = ServiceStore.instantiate_service!("GoogleBookSearch", nil)
26
22
 
27
- # Bunch of responses in the proper format somtimes followed by the hash that
28
- # will result. The values here are not necessarily true/real.
29
- # For instance the preview value is likely faked to test methods
30
- # Only those currently used are uncommented.
31
- @response_one = 'gbscallback({"ISBN:030905382X":{"bib_key":"ISBN:030905382X","info_url":"http://books.google.com/books?id=XiiYq5U1qEUC\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=XiiYq5U1qEUC\x26printsec=frontcover\x26sig=9-7ypznOwL_rECoKJLizCBpodds\x26source=gbs_ViewAPI","thumbnail_url":"http://bks7.books.google.com/books?id=XiiYq5U1qEUC\x26pg=PP1\x26img=1\x26zoom=5\x26sig=2XmDi4HEhbqply9YjIsuopFQLAk","preview":"noview"}});'
32
- #@one_full_view = 'gbscallback({"ISBN:1582183392":{"bib_key":"ISBN:1582183392","info_url":"http://books.google.com/books?id=bFGPoGrAXbwC\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=bFGPoGrAXbwC\x26printsec=frontcover\x26sig=kYnPnuSmFdbm5rJfxNUN0_Qa3Zk\x26source=gbs_ViewAPI","thumbnail_url":"http://bks8.books.google.com/books?id=bFGPoGrAXbwC\x26pg=PP1\x26img=1\x26zoom=5\x26sig=bBu6nZ_q8k5uKZ43RrdBOElOCiA","preview":"full"}});'
33
- #@one_partial_view = 'gbscallback({"ISBN:9780618680009":{"bib_key":"ISBN:9780618680009","info_url":"http://books.google.com/books?id=yq1xDpicghkC\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=yq1xDpicghkC\x26printsec=frontcover\x26sig=wuZrXklCy_Duenlw3Ea0MTgIhYQ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks8.books.google.com/books?id=yq1xDpicghkC\x26pg=PP1\x26img=1\x26zoom=5\x26sig=3sezA1j1-qzTTtI5E8PTdHJDkHw","preview":"partial"}});'
34
- @response_three_duplicate_no_view = 'gbscallback({"ISBN:0393044548":{"bib_key":"ISBN:0393044548","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks3.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=32ieZbDQYbQAeCNfW-vek8SfOxc","preview":"noview"},"OCLC:2985768":{"bib_key":"OCLC:2985768","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks4.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=Z98qalA95yde4XY6VO-1ZF0tKlE","preview":"noview"},"LCCN:76030648":{"bib_key":"LCCN:76030648","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks5.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=_qfxqS7dLZ7Oi48sFIBssQUbd4E","preview":"noview"}});'
35
- @a_three_duplicate_no_view = [{
36
- "info_url"=>
37
- "http://books.google.com/books?id=E4R9AQAACAAJ&source=gbs_ViewAPI",
38
- "preview_url"=>
39
- "http://books.google.com/books?id=E4R9AQAACAAJ&source=gbs_ViewAPI",
40
- "preview"=>"noview",
41
- "bib_key"=>"ISBN:0393044548, OCLC:2985768, LCCN:76030648",
42
- "thumbnail_url"=>
43
- "http://bks3.books.google.com/books?id=E4R9AQAACAAJ&printsec=frontcover&img=1&zoom=5&sig=32ieZbDQYbQAeCNfW-vek8SfOxc"
44
- }]
45
-
23
+ @data_frankenstein =
24
+ {"totalItems"=>1, "kind"=>"books#volumes", "items"=>[{"accessInfo"=>{"embeddable"=>true, "webReaderLink"=>"http://books.google.com/books/reader?id=QKgVAAAAYAAJ&as_pt=BOOKS&printsec=frontcover&output=reader&source=gbs_api", "epub"=>{"isAvailable"=>true, "downloadLink"=>"http://books.google.com/books/download/Frankenstein.epub?id=QKgVAAAAYAAJ&output=epub&source=gbs_api"}, "viewability"=>"ALL_PAGES", "publicDomain"=>true, "country"=>"US", "pdf"=>{"isAvailable"=>true, "downloadLink"=>"http://books.google.com/books/download/Frankenstein.pdf?id=QKgVAAAAYAAJ&output=pdf&sig=ACfU3U3nhOFhUroWh_b-nMaAulaAV6kjlw&source=gbs_api"}, "textToSpeechPermission"=>"ALLOWED", "accessViewStatus"=>"FULL_PUBLIC_DOMAIN"}, "searchInfo"=>{"textSnippet"=>"FRANKENSTEIN or The Modern Prometheus CHAPTER I. I Am by birth a Genevese; and <br> my family is one of the most distinguished of that republic. My ancestors had <br> been for many years counselors and syndics; and my father had filled several <b>...</b>"}, "etag"=>"TUqYf+e+c9k", "kind"=>"books#volume", "volumeInfo"=>{"infoLink"=>"http://books.google.com/books?id=QKgVAAAAYAAJ&dq=OCLC2364071&as_pt=BOOKS&source=gbs_api", "contentVersion"=>"0.0.1.0.full.3", "categories"=>["Fiction"], "title"=>"Frankenstein", "printType"=>"BOOK", "ratingsCount"=>279, "subtitle"=>"or, the Modern Prometheus", "previewLink"=>"http://books.google.com/books?id=QKgVAAAAYAAJ&printsec=frontcover&dq=OCLC2364071&as_pt=BOOKS&cd=1&source=gbs_api", "imageLinks"=>{"smallThumbnail"=>"http://bks6.books.google.com/books?id=QKgVAAAAYAAJ&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api", "thumbnail"=>"http://bks6.books.google.com/books?id=QKgVAAAAYAAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"}, "pageCount"=>332, "language"=>"en", "canonicalVolumeLink"=>"http://books.google.com/books/about/Frankenstein.html?id=QKgVAAAAYAAJ", "averageRating"=>4.0, "authors"=>["Mary Wollstonecraft Shelley"], "industryIdentifiers"=>[{"type"=>"OTHER", "identifier"=>"PRNC:32101064790353"}], "publishedDate"=>"1922"}, "saleInfo"=>{"isEbook"=>true, "saleability"=>"FREE", "country"=>"US"}, "id"=>"QKgVAAAAYAAJ", "selfLink"=>"https://www.googleapis.com/books/v1/volumes/QKgVAAAAYAAJ"}]}
46
25
 
47
- @data_frankenstein = Hpricot.XML("<?xml version=\"1.0\" encoding=\"UTF-8\"?><feed xmlns:gd=\"http://schemas.google.com/g/2005\" xmlns:dc=\"http://purl.org/dc/terms\" xmlns:gbs=\"http://schemas.google.com/books/2008\" xmlns:openSearch=\"http://a9.com/-/spec/opensearchrss/1.0/\" xmlns=\"http://www.w3.org/2005/Atom\"><id>http://www.google.com/books/feeds/volumes</id><updated>2009-04-29T22:02:42.000Z</updated><category term=\"http://schemas.google.com/books/2008#volume\" scheme=\"http://schemas.google.com/g/2005#kind\"></category><title type=\"text\">Search results for ISBN9780393964585 OR OCLC33045872</title><link href=\"http://www.google.com\" rel=\"alternate\" type=\"text/html\" /><link href=\"http://www.google.com/books/feeds/volumes\" rel=\"http://schemas.google.com/g/2005#feed\" type=\"application/atom+xml\" /><link href=\"http://www.google.com/books/feeds/volumes?q=ISBN9780393964585+OR+OCLC33045872\" rel=\"self\" type=\"application/atom+xml\" /><author><name>Google Books Search</name><uri>http://www.google.com</uri></author><generator version=\"beta\">Google Book Search data API</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>20</openSearch:itemsPerPage><entry><id>http://www.google.com/books/feeds/volumes/92EbHgAACAAJ</id><updated>2009-04-29T22:02:42.000Z</updated><category term=\"http://schemas.google.com/books/2008#volume\" scheme=\"http://schemas.google.com/g/2005#kind\"></category><title type=\"text\">Frankenstein</title><link href=\"http://bks5.books.google.com/books?id=92EbHgAACAAJ&amp;printsec=frontcover&amp;img=1&amp;zoom=5&amp;sig=ACfU3U10W3ycsrdiB-udzUYGnYtkVIp5tQ&amp;source=gbs_gdata\" rel=\"http://schemas.google.com/books/2008/thumbnail\" type=\"image/x-unknown\" /><link href=\"http://books.google.com/books?id=92EbHgAACAAJ&amp;dq=ISBN9780393964585+OR+OCLC33045872&amp;ie=ISO-8859-1&amp;source=gbs_gdata\" rel=\"http://schemas.google.com/books/2008/info\" type=\"text/html\" /><link href=\"http://books.google.com/books?id=92EbHgAACAAJ&amp;dq=ISBN9780393964585+OR+OCLC33045872&amp;ie=ISO-8859-1&amp;source=gbs_gdata\" rel=\"http://schemas.google.com/books/2008/preview\" type=\"text/html\" /><link href=\"http://www.google.com/books/feeds/users/me/volumes\" rel=\"http://schemas.google.com/books/2008/annotation\" type=\"application/atom+xml\" /><link href=\"http://books.google.com/books?id=92EbHgAACAAJ&amp;dq=ISBN9780393964585+OR+OCLC33045872&amp;ie=ISO-8859-1\" rel=\"alternate\" type=\"text/html\" /><link href=\"http://www.google.com/books/feeds/volumes/92EbHgAACAAJ\" rel=\"self\" type=\"application/atom+xml\" /><gbs:embeddability value=\"http://schemas.google.com/books/2008#not_embeddable\"></gbs:embeddability><gbs:openAccess value=\"http://schemas.google.com/books/2008#disabled\"></gbs:openAccess><gbs:viewability value=\"http://schemas.google.com/books/2008#view_no_pages\"></gbs:viewability><dc:creator>Mary Wollstonecraft Shelley</dc:creator><dc:creator>J. Paul Hunter</dc:creator><dc:date>1996-02-23</dc:date><dc:description>... ISBN9780393964585 9780393964585 LCCN95037928 OXFORD503855446 \r\nBIBoxford_UkOxUb11900853 BIBloc_95037928 OCLC78250571 OCLC33045872 ...</dc:description><dc:format>339 pages</dc:format><dc:identifier>92EbHgAACAAJ</dc:identifier><dc:identifier>ISBN:0393964582</dc:identifier><dc:identifier>ISBN:9780393964585</dc:identifier><dc:publisher>W. W. Norton &amp; Company</dc:publisher><dc:subject>Juvenile Fiction</dc:subject><dc:title>Frankenstein</dc:title><dc:title>The 1818 Text, Contexts, Nineteenth-century Responses, Modern Criticism</dc:title></entry></feed>")
48
-
49
- #@one_fake_full_fake_partial = 'gbscallback({"ISBN:0393044548":{"bib_key":"ISBN:0393044548","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks3.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=32ieZbDQYbQAeCNfW-vek8SfOxc","preview":"full"},"OCLC:2985768":{"bib_key":"OCLC:2985768","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks4.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=Z98qalA95yde4XY6VO-1ZF0tKlE","preview":"noview"},"LCCN:76030648":{"bib_key":"LCCN:76030648","info_url":"http://books.google.com/books?id=E4R9AQAACAAJx\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks5.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=_qfxqS7dLZ7Oi48sFIBssQUbd4E","preview":"partial"}});'
50
- #@two_fake_full = 'gbscallback({"ISBN:0393044548":{"bib_key":"ISBN:0393044548","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks3.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=32ieZbDQYbQAeCNfW-vek8SfOxc","preview":"full"},"OCLC:2985768":{"bib_key":"OCLC:2985768","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks4.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=Z98qalA95yde4XY6VO-1ZF0tKlE","preview":"noview"},"LCCN:76030648":{"bib_key":"LCCN:76030648","info_url":"http://books.google.com/books?id=E4R9AQAACAAJx\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks5.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=_qfxqS7dLZ7Oi48sFIBssQUbd4E","preview":"full"}});'
51
- #@one_fake_full_one_fake_noview = 'gbscallback({"ISBN:0393044548":{"bib_key":"ISBN:0393044548","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks3.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=32ieZbDQYbQAeCNfW-vek8SfOxc","preview":"full"},"OCLC:2985768":{"bib_key":"OCLC:2985768","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks4.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=Z98qalA95yde4XY6VO-1ZF0tKlE","preview":"noview"},"LCCN:76030648":{"bib_key":"LCCN:76030648","info_url":"http://books.google.com/books?id=E4R9AQAACAAJx\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks5.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=_qfxqS7dLZ7Oi48sFIBssQUbd4E","preview":"noview"}});'
52
- #@one_fake_partial_one_fake_noview = 'gbscallback({"ISBN:0393044548":{"bib_key":"ISBN:0393044548","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks3.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=32ieZbDQYbQAeCNfW-vek8SfOxc","preview":"partial"},"OCLC:2985768":{"bib_key":"OCLC:2985768","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks4.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=Z98qalA95yde4XY6VO-1ZF0tKlE","preview":"noview"},"LCCN:76030648":{"bib_key":"LCCN:76030648","info_url":"http://books.google.com/books?id=E4R9AQAACAAJx\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks5.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=_qfxqS7dLZ7Oi48sFIBssQUbd4E","preview":"noview"}});'
53
- #@two_no_view_one_fake_partial = 'gbscallback({"ISBN:0393044548":{"bib_key":"ISBN:0393044548","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks3.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=32ieZbDQYbQAeCNfW-vek8SfOxc","preview":"noview"},"OCLC:2985768":{"bib_key":"OCLC:2985768","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks4.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=Z98qalA95yde4XY6VO-1ZF0tKlE","preview":"noview"},"LCCN:76030648":{"bib_key":"LCCN:76030648","info_url":"http://books.google.com/books?id=E4R9AQAACAAJx\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks5.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=_qfxqS7dLZ7Oi48sFIBssQUbd4E","preview":"partial"}});'
54
- #@two_full_one_fake_partial = 'gbscallback({"ISBN:0393044548":{"bib_key":"ISBN:0393044548","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks3.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=32ieZbDQYbQAeCNfW-vek8SfOxc","preview":"full"},"OCLC:2985768":{"bib_key":"OCLC:2985768","info_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks4.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=Z98qalA95yde4XY6VO-1ZF0tKlE","preview":"full"},"LCCN:76030648":{"bib_key":"LCCN:76030648","info_url":"http://books.google.com/books?id=E4R9AQAACAAJx\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=E4R9AQAACAAJ\x26source=gbs_ViewAPI","thumbnail_url":"http://bks5.books.google.com/books?id=E4R9AQAACAAJ\x26printsec=frontcover\x26img=1\x26zoom=5\x26sig=_qfxqS7dLZ7Oi48sFIBssQUbd4E","preview":"partial"}});'
55
- #@one_partial_view = 'gbscallback({"ISBN:030905382X":{"bib_key":"ISBN:030905382X","info_url":"http://books.google.com/books?id=XiiYq5U1qEUC\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=XiiYq5U1qEUC\x26printsec=frontcover\x26sig=9-7ypznOwL_rECoKJLizCBpodds\x26source=gbs_ViewAPI","thumbnail_url":"http://bks7.books.google.com/books?id=XiiYq5U1qEUC\x26pg=PP1\x26img=1\x26zoom=5\x26sig=2XmDi4HEhbqply9YjIsuopFQLAk","preview":"partial"}});'
56
- #@one_fake_noview = 'gbscallback({"ISBN:030905382X":{"bib_key":"ISBN:030905382X","info_url":"http://books.google.com/books?id=XiiYq5U1qEUC\x26source=gbs_ViewAPI","preview_url":"http://books.google.com/books?id=XiiYq5U1qEUC\x26printsec=frontcover\x26sig=9-7ypznOwL_rECoKJLizCBpodds\x26source=gbs_ViewAPI","thumbnail_url":"http://bks7.books.google.com/books?id=XiiYq5U1qEUC\x26pg=PP1\x26img=1\x26zoom=5\x26sig=2XmDi4HEhbqply9YjIsuopFQLAk","preview":"noview"}});'
57
26
  end
58
27
 
59
28
 
60
29
 
61
30
  def test_initialize_minimum
62
31
  gbs = GoogleBookSearch.new({"priority"=>1})
63
- assert_equal(1, gbs.priority)
64
- assert_equal('Google Book Search', gbs.display_name)
32
+ assert_equal(1, gbs.priority)
33
+ assert_equal('Google Books', gbs.display_name)
65
34
  assert_equal(1, gbs.num_full_views)
66
35
  assert_equal(1, gbs.priority)
67
36
  assert_equal('standard', gbs.task)
@@ -70,7 +39,7 @@ class GoogleBookSearchTest < Test::Unit::TestCase
70
39
  def test_get_bibkeys
71
40
  f = referents(:frankenstein)
72
41
  keys = @gbs_default.get_bibkeys(f)
73
- expected = CGI.escape('ISBN9780393964585 OR OCLC33045872')
42
+ expected = CGI.escape('isbn:9780393964585 OR "OCLC33045872"')
74
43
  assert_equal(expected, keys)
75
44
  end
76
45
 
@@ -79,17 +48,22 @@ class GoogleBookSearchTest < Test::Unit::TestCase
79
48
  # something back. The server for the thumbnail changes, so we can't do a
80
49
  # simple match and a huge regexp was making my head hurt.
81
50
  def test_do_query
82
- hpricot_response = @gbs_default.do_query('OCLC02364071', requests(:frankenstein))
51
+ hashified_response = @gbs_default.do_query('OCLC2364071', requests(:frankenstein))
52
+
53
+ assert_not_nil hashified_response
54
+
55
+ assert_not_nil hashified_response["totalItems"]
83
56
 
84
- assert hpricot_response.at("dc:identifier")
57
+ assert_operator hashified_response["totalItems"], :>, 0
85
58
  end
86
59
 
87
60
 
88
- def test_create_fulltext_service_response_nil
61
+ def test_create_fulltext_service_response
62
+ # frankenstein's got fulltext now.
89
63
  request = requests(:frankenstein)
90
64
  fulltext_shown = @gbs_default.create_fulltext_service_response(request,
91
65
  @data_frankenstein)
92
- assert_nil(fulltext_shown)
66
+ assert(true, fulltext_shown)
93
67
  end
94
68
 
95
69
  def test_find_thumbnail_url