exlibris-aleph 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +199 -82
- data/Rakefile +8 -14
- data/lib/exlibris-aleph.rb +0 -3
- data/lib/exlibris/aleph/admin_library.rb +27 -0
- data/lib/exlibris/aleph/api/base.rb +27 -0
- data/lib/exlibris/aleph/api/client/base.rb +86 -0
- data/lib/exlibris/aleph/api/client/patron.rb +20 -0
- data/lib/exlibris/aleph/api/client/patron/address.rb +22 -0
- data/lib/exlibris/aleph/api/client/patron/record.rb +23 -0
- data/lib/exlibris/aleph/api/client/patron/record/item.rb +26 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/create_hold.rb +31 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/create_hold/parameters.rb +55 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/hold.rb +29 -0
- data/lib/exlibris/aleph/api/client/patron/status.rb +22 -0
- data/lib/exlibris/aleph/api/client/record.rb +21 -0
- data/lib/exlibris/aleph/api/client/record/filters.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/holding.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/holdings.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/item.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/items.rb +23 -0
- data/lib/exlibris/aleph/api/reader/base.rb +15 -0
- data/lib/exlibris/aleph/api/reader/patron.rb +19 -0
- data/lib/exlibris/aleph/api/reader/patron/address.rb +90 -0
- data/lib/exlibris/aleph/api/reader/patron/record.rb +38 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item.rb +77 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item/create_hold.rb +33 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item/hold.rb +56 -0
- data/lib/exlibris/aleph/api/reader/patron/status.rb +33 -0
- data/lib/exlibris/aleph/api/reader/record.rb +10 -0
- data/lib/exlibris/aleph/api/reader/record/item.rb +45 -0
- data/lib/exlibris/aleph/collection.rb +26 -0
- data/lib/exlibris/aleph/config.rb +17 -57
- data/lib/exlibris/aleph/holding.rb +59 -0
- data/lib/exlibris/aleph/holding/metadata.rb +28 -0
- data/lib/exlibris/aleph/holdings.rb +51 -0
- data/lib/exlibris/aleph/item.rb +138 -0
- data/lib/exlibris/aleph/item/call_number.rb +14 -0
- data/lib/exlibris/aleph/item/circulation_policy.rb +30 -0
- data/lib/exlibris/aleph/item/circulation_policy/display.rb +16 -0
- data/lib/exlibris/aleph/item/circulation_policy/identifier.rb +34 -0
- data/lib/exlibris/aleph/item/circulation_policy/privileges.rb +72 -0
- data/lib/exlibris/aleph/item/circulation_status.rb +31 -0
- data/lib/exlibris/aleph/item/display_mask.rb +19 -0
- data/lib/exlibris/aleph/item/opac_note.rb +17 -0
- data/lib/exlibris/aleph/item/processing_status.rb +23 -0
- data/lib/exlibris/aleph/item/queue.rb +32 -0
- data/lib/exlibris/aleph/item/status.rb +23 -0
- data/lib/exlibris/aleph/items.rb +51 -0
- data/lib/exlibris/aleph/metadata.rb +25 -0
- data/lib/exlibris/aleph/patron.rb +18 -82
- data/lib/exlibris/aleph/patron/address.rb +56 -0
- data/lib/exlibris/aleph/patron/circulation_policy.rb +26 -0
- data/lib/exlibris/aleph/patron/circulation_policy/identifier.rb +29 -0
- data/lib/exlibris/aleph/patron/circulation_policy/privileges.rb +56 -0
- data/lib/exlibris/aleph/patron/record.rb +39 -0
- data/lib/exlibris/aleph/patron/record/circulation_policy.rb +18 -0
- data/lib/exlibris/aleph/patron/record/circulation_policy/privileges.rb +42 -0
- data/lib/exlibris/aleph/patron/record/item.rb +63 -0
- data/lib/exlibris/aleph/patron/record/item/circulation_policy.rb +21 -0
- data/lib/exlibris/aleph/patron/record/item/circulation_policy/privileges.rb +39 -0
- data/lib/exlibris/aleph/patron/record/item/create_hold.rb +43 -0
- data/lib/exlibris/aleph/patron/record/item/hold.rb +41 -0
- data/lib/exlibris/aleph/patron/status.rb +19 -0
- data/lib/exlibris/aleph/pickup_location.rb +12 -0
- data/lib/exlibris/aleph/record.rb +14 -43
- data/lib/exlibris/aleph/record/metadata.rb +8 -0
- data/lib/exlibris/aleph/sub_library.rb +30 -0
- data/lib/exlibris/aleph/table/base.rb +22 -0
- data/lib/exlibris/aleph/table/collections.rb +17 -0
- data/lib/exlibris/aleph/table/item/circulation_policies.rb +65 -0
- data/lib/exlibris/aleph/table/item/display_masks.rb +19 -0
- data/lib/exlibris/aleph/table/patron/circulation_policies.rb +47 -0
- data/lib/exlibris/aleph/table/patron/statuses.rb +19 -0
- data/lib/exlibris/aleph/table/reader/base.rb +57 -0
- data/lib/exlibris/aleph/table/reader/collections.rb +35 -0
- data/lib/exlibris/aleph/table/reader/item_circulation_policies.rb +50 -0
- data/lib/exlibris/aleph/table/reader/item_display_masks.rb +19 -0
- data/lib/exlibris/aleph/table/reader/matcher/base.rb +30 -0
- data/lib/exlibris/aleph/table/reader/matcher/collections.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/item_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/item_display_masks.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/patron_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/patron_statuses.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/sub_libraries.rb +17 -0
- data/lib/exlibris/aleph/table/reader/patron_circulation_policies.rb +51 -0
- data/lib/exlibris/aleph/table/reader/patron_statuses.rb +19 -0
- data/lib/exlibris/aleph/table/reader/row/base.rb +25 -0
- data/lib/exlibris/aleph/table/reader/row/collections.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/item_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/row/item_display_masks.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/patron_circulation_policies.rb +20 -0
- data/lib/exlibris/aleph/table/reader/row/patron_statuses.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/sub_libraries.rb +13 -0
- data/lib/exlibris/aleph/table/reader/sub_libraries.rb +32 -0
- data/lib/exlibris/aleph/table/sub_libraries.rb +11 -0
- data/lib/exlibris/aleph/tables_manager.rb +66 -0
- data/lib/exlibris/aleph/version.rb +1 -1
- data/spec/exlibris/aleph/admin_library_spec.rb +83 -0
- data/spec/exlibris/aleph/api/base_spec.rb +23 -0
- data/spec/exlibris/aleph/api/client/base_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron/address_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/create_hold/parameters_spec.rb +101 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/create_hold_spec.rb +102 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/hold_spec.rb +89 -0
- data/spec/exlibris/aleph/api/client/patron/record/item_spec.rb +52 -0
- data/spec/exlibris/aleph/api/client/patron/record_spec.rb +45 -0
- data/spec/exlibris/aleph/api/client/patron/status_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron_spec.rb +38 -0
- data/spec/exlibris/aleph/api/client/record/filters_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record/holding_spec.rb +41 -0
- data/spec/exlibris/aleph/api/client/record/holdings_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record/item_spec.rb +41 -0
- data/spec/exlibris/aleph/api/client/record/items_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record_spec.rb +43 -0
- data/spec/exlibris/aleph/api/reader/base_spec.rb +18 -0
- data/spec/exlibris/aleph/api/reader/patron/address_spec.rb +151 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item/create_hold_spec.rb +65 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item/hold_spec.rb +145 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item_spec.rb +266 -0
- data/spec/exlibris/aleph/api/reader/patron/record_spec.rb +98 -0
- data/spec/exlibris/aleph/api/reader/patron/status_spec.rb +57 -0
- data/spec/exlibris/aleph/api/reader/patron_spec.rb +28 -0
- data/spec/exlibris/aleph/api/reader/record/item_spec.rb +178 -0
- data/spec/exlibris/aleph/collection_spec.rb +95 -0
- data/spec/exlibris/aleph/config_spec.rb +17 -0
- data/spec/exlibris/aleph/holding/metadata_spec.rb +57 -0
- data/spec/exlibris/aleph/holding_spec.rb +53 -0
- data/spec/exlibris/aleph/holdings_spec.rb +59 -0
- data/spec/exlibris/aleph/item/call_number_spec.rb +20 -0
- data/spec/exlibris/aleph/item/circulation_policy/display_spec.rb +33 -0
- data/spec/exlibris/aleph/item/circulation_policy/identifier_spec.rb +154 -0
- data/spec/exlibris/aleph/item/circulation_policy/privileges_spec.rb +183 -0
- data/spec/exlibris/aleph/item/circulation_policy_spec.rb +146 -0
- data/spec/exlibris/aleph/item/circulation_status_spec.rb +83 -0
- data/spec/exlibris/aleph/item/display_mask_spec.rb +72 -0
- data/spec/exlibris/aleph/item/opac_note_spec.rb +19 -0
- data/spec/exlibris/aleph/item/processing_status_spec.rb +75 -0
- data/spec/exlibris/aleph/item/queue_spec.rb +31 -0
- data/spec/exlibris/aleph/item/status_spec.rb +80 -0
- data/spec/exlibris/aleph/item_spec.rb +97 -0
- data/spec/exlibris/aleph/items_spec.rb +59 -0
- data/spec/exlibris/aleph/metadata_spec.rb +118 -0
- data/spec/exlibris/aleph/patron/address_spec.rb +68 -0
- data/spec/exlibris/aleph/patron/circulation_policy/identifier_spec.rb +115 -0
- data/spec/exlibris/aleph/patron/circulation_policy/privileges_spec.rb +128 -0
- data/spec/exlibris/aleph/patron/circulation_policy_spec.rb +119 -0
- data/spec/exlibris/aleph/patron/record/circulation_policy/privileges_spec.rb +88 -0
- data/spec/exlibris/aleph/patron/record/circulation_policy_spec.rb +37 -0
- data/spec/exlibris/aleph/patron/record/item/circulation_policy/privileges_spec.rb +76 -0
- data/spec/exlibris/aleph/patron/record/item/circulation_policy_spec.rb +52 -0
- data/spec/exlibris/aleph/patron/record/item/create_hold_spec.rb +49 -0
- data/spec/exlibris/aleph/patron/record/item/hold_spec.rb +41 -0
- data/spec/exlibris/aleph/patron/record/item_spec.rb +64 -0
- data/spec/exlibris/aleph/patron/record_spec.rb +30 -0
- data/spec/exlibris/aleph/patron/status_spec.rb +72 -0
- data/spec/exlibris/aleph/patron_spec.rb +28 -0
- data/spec/exlibris/aleph/pickup_location_spec.rb +19 -0
- data/spec/exlibris/aleph/record/metadata_spec.rb +120 -0
- data/spec/exlibris/aleph/record_spec.rb +44 -0
- data/spec/exlibris/aleph/sub_library_spec.rb +110 -0
- data/spec/exlibris/aleph/table/base_spec.rb +17 -0
- data/spec/exlibris/aleph/table/collections_spec.rb +24 -0
- data/spec/exlibris/aleph/table/item/circulation_policies_spec.rb +65 -0
- data/spec/exlibris/aleph/table/item/display_masks_spec.rb +26 -0
- data/spec/exlibris/aleph/table/patron/circulation_policies_spec.rb +47 -0
- data/spec/exlibris/aleph/table/patron/statuses_spec.rb +26 -0
- data/spec/exlibris/aleph/table/reader/base_spec.rb +28 -0
- data/spec/exlibris/aleph/table/reader/collections_spec.rb +33 -0
- data/spec/exlibris/aleph/table/reader/item_circulation_policies_spec.rb +33 -0
- data/spec/exlibris/aleph/table/reader/item_display_masks_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/matcher/base_spec.rb +32 -0
- data/spec/exlibris/aleph/table/reader/matcher/collections_spec.rb +39 -0
- data/spec/exlibris/aleph/table/reader/matcher/item_circulation_policies_spec.rb +39 -0
- data/spec/exlibris/aleph/table/reader/matcher/item_display_masks_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/patron_circulation_policies_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/patron_statuses_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/sub_libraries_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/patron_circulation_policies_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/patron_statuses_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/row/base_spec.rb +20 -0
- data/spec/exlibris/aleph/table/reader/row/collections_spec.rb +37 -0
- data/spec/exlibris/aleph/table/reader/row/item_circulation_policies_spec.rb +89 -0
- data/spec/exlibris/aleph/table/reader/row/item_display_masks_spec.rb +29 -0
- data/spec/exlibris/aleph/table/reader/row/patron_circulation_policies_spec.rb +115 -0
- data/spec/exlibris/aleph/table/reader/row/patron_statuses_spec.rb +29 -0
- data/spec/exlibris/aleph/table/reader/row/sub_libraries_spec.rb +41 -0
- data/spec/exlibris/aleph/table/reader/sub_libraries_spec.rb +36 -0
- data/spec/exlibris/aleph/table/sub_libraries_spec.rb +19 -0
- data/spec/exlibris/aleph/tables_manager_spec.rb +120 -0
- data/spec/exlibris/aleph_spec.rb +5 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/mnt/aleph_tab/adm50/tab/filename +0 -0
- data/{test → spec/support}/mnt/aleph_tab/alephe/tab/tab_sub_library.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/pc_tab_exp_field_extended.eng +0 -0
- data/{test/mnt/aleph_tab → spec/support/mnt/aleph_tab/nyu50/tab}/tab15.eng +2 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab16 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab31 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab37 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab40.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab_www_item_desc.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/pc_tab_exp_field_extended.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab15.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab16 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab31 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab37 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab40.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab_www_item_desc.eng +0 -0
- data/spec/vcr_cassettes/patron.yml +1443 -0
- data/spec/vcr_cassettes/record.yml +763 -0
- metadata +351 -165
- data/lib/exlibris/aleph/abstract.rb +0 -28
- data/lib/exlibris/aleph/rest/base.rb +0 -56
- data/lib/exlibris/aleph/tab_helper.rb +0 -303
- data/lib/exlibris/aleph/tabs_parser/base.rb +0 -49
- data/lib/exlibris/aleph/tabs_parser/pc_tab_exp_field_extended.rb +0 -20
- data/lib/exlibris/aleph/tabs_parser/sub_library.rb +0 -32
- data/lib/exlibris/aleph/tabs_parser/tab15_by_item_process_status.rb +0 -33
- data/lib/exlibris/aleph/tabs_parser/tab15_by_item_status.rb +0 -33
- data/lib/exlibris/aleph/tabs_parser/tab31.rb +0 -39
- data/lib/exlibris/aleph/tabs_parser/tab37.rb +0 -63
- data/lib/exlibris/aleph/tabs_parser/tab40.rb +0 -20
- data/lib/exlibris/aleph/tabs_parser/tab_sub_library.rb +0 -21
- data/lib/exlibris/aleph/tabs_parser/tab_www_item_desc.rb +0 -20
- data/lib/exlibris/aleph/task_installer.rb +0 -25
- data/lib/exlibris/aleph/write_attributes.rb +0 -38
- data/lib/exlibris/aleph/xml_util.rb +0 -50
- data/lib/exlibris/aleph/xservice/bor_auth.rb +0 -47
- data/lib/tasks/exlibris-aleph_tasks.rake +0 -48
- data/test/config/aleph/alephe/sub_libraries.yml +0 -801
- data/test/config/aleph/nyu50/collections.yml +0 -1168
- data/test/config/aleph/nyu50/item_permissions_by_item_process_status.yml +0 -61876
- data/test/config/aleph/nyu50/item_permissions_by_item_status.yml +0 -17319
- data/test/config/aleph/nyu50/items.yml +0 -617
- data/test/config/aleph/nyu50/patron_permissions.yml +0 -19720
- data/test/config/aleph/nyu50/patrons.yml +0 -249
- data/test/config/aleph/nyu50/pickup_locations.yml +0 -2910
- data/test/config/aleph/nyu51/collections.yml +0 -41
- data/test/config/aleph/nyu51/item_permissions_by_item_process_status.yml +0 -7689
- data/test/config/aleph/nyu51/item_permissions_by_item_status.yml +0 -430
- data/test/config/aleph/nyu51/items.yml +0 -617
- data/test/config/aleph/nyu51/patron_permissions.yml +0 -6588
- data/test/config/aleph/nyu51/patrons.yml +0 -237
- data/test/config/aleph/nyu51/pickup_locations.yml +0 -456
- data/test/config_test.rb +0 -24
- data/test/exlibris-aleph_test.rb +0 -7
- data/test/mnt/aleph_tab/nyu50/tab/tab15.eng +0 -4742
- data/test/mnt/aleph_tab/pc_tab_exp_field_extended.eng +0 -158
- data/test/mnt/aleph_tab/tab16 +0 -3792
- data/test/mnt/aleph_tab/tab31 +0 -998
- data/test/mnt/aleph_tab/tab37 +0 -405
- data/test/mnt/aleph_tab/tab40.eng +0 -335
- data/test/mnt/aleph_tab/tab_sub_library.eng +0 -378
- data/test/mnt/aleph_tab/tab_www_item_desc.eng +0 -208
- data/test/patron_test.rb +0 -98
- data/test/record_benchmarks.rb +0 -26
- data/test/record_test.rb +0 -64
- data/test/support/config.yml +0 -2
- data/test/tab_helper_benchmarks.rb +0 -53
- data/test/tab_helper_test.rb +0 -192
- data/test/test_helper.rb +0 -46
- data/test/vcr_cassettes/bor_auth.yml +0 -42
- data/test/vcr_cassettes/patron.yml +0 -142
- data/test/vcr_cassettes/patron_address.yml +0 -45
- data/test/vcr_cassettes/patron_bogus_url.yml +0 -731
- data/test/vcr_cassettes/patron_error.yml +0 -93
- data/test/vcr_cassettes/record.yml +0 -146
- data/test/vcr_cassettes/record_bogus_url.yml +0 -690
- data/test/xservice/bor_auth_test.rb +0 -28
data/test/patron_test.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
class PatronTest < ActiveSupport::TestCase
|
3
|
-
setup do
|
4
|
-
@rest_url = "http://aleph.library.nyu.edu:1891/rest-dlf"
|
5
|
-
@aleph_doc_library = "NYU01"
|
6
|
-
@aleph_doc_number = "000062856"
|
7
|
-
@nyuidn = "BOR_ID"
|
8
|
-
@aleph_adm_library = "NYU50"
|
9
|
-
@aleph_item_id = "NYU50000062856000010"
|
10
|
-
@aleph_renew_item_id = "NYU50003034208"
|
11
|
-
@pickup_location = "BOBST"
|
12
|
-
@bogus_url = "http://library.nyu.edu/bogus"
|
13
|
-
end
|
14
|
-
|
15
|
-
# Test exception handling for bogus response.
|
16
|
-
test "test_bogus_response" do
|
17
|
-
VCR.use_cassette('patron bogus url') do
|
18
|
-
patron = Exlibris::Aleph::Patron.new(patron_id: @nyuidn, rest_url: @bogus_url)
|
19
|
-
assert_raise(MultiXml::ParseError) { patron.loans }
|
20
|
-
assert_raise(MultiXml::ParseError) { patron.renew_loans() }
|
21
|
-
assert_raise(MultiXml::ParseError) { patron.renew_loans(@aleph_renew_item_id) }
|
22
|
-
assert_raise(MultiXml::ParseError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location}) }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Test patron
|
27
|
-
test "test_patron" do
|
28
|
-
VCR.use_cassette('patron') do
|
29
|
-
patron = Exlibris::Aleph::Patron.new(patron_id: @nyuidn, rest_url: @rest_url)
|
30
|
-
loans = patron.loans
|
31
|
-
assert_kind_of Array, loans
|
32
|
-
assert((not loans.empty?), "Loans empty.")
|
33
|
-
loans.each { |loan| assert_kind_of Hash, loan }
|
34
|
-
assert_nil(patron.error, "Failure in #{patron.class} while getting loans: #{patron.error}")
|
35
|
-
renew_all_loans = patron.renew_loans()
|
36
|
-
assert_kind_of Array, renew_all_loans
|
37
|
-
assert((not renew_all_loans.empty?), "Renew all loans empty.")
|
38
|
-
renew_all_loans.each { |renew_all_loan| assert_kind_of Hash, renew_all_loan }
|
39
|
-
assert_nil(patron.error, "Failure in #{patron.class} while renewing all loans: #{patron.error}")
|
40
|
-
renew_loans = patron.renew_loans(@aleph_renew_item_id)
|
41
|
-
assert_kind_of Array, renew_loans
|
42
|
-
assert((not renew_loans.empty?), "Renew loans empty.")
|
43
|
-
renew_loans.each { |renew_loan| assert_kind_of Hash, renew_loan }
|
44
|
-
assert_nil(patron.error, "Failure in #{patron.class} while renewing loan #{@aleph_renew_item_id}: #{patron.error}")
|
45
|
-
place_hold = patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location})
|
46
|
-
assert_kind_of Hash, place_hold
|
47
|
-
assert_nil(patron.error, "Failure in #{patron.class} while placing hold: #{patron.error}")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Test patron
|
52
|
-
test "test patron address" do
|
53
|
-
VCR.use_cassette('patron address') do
|
54
|
-
patron = Exlibris::Aleph::Patron.new(patron_id: @nyuidn, rest_url: @rest_url)
|
55
|
-
address = patron.address
|
56
|
-
assert_kind_of Hash, address
|
57
|
-
assert_nil(patron.error, "Failure in #{patron.class} while getting address: #{patron.error}")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# Test patron
|
62
|
-
test "test patron error" do
|
63
|
-
VCR.use_cassette('patron error') do
|
64
|
-
patron = Exlibris::Aleph::Patron.new(patron_id: @nyuidn, rest_url: @rest_url)
|
65
|
-
assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {}) }
|
66
|
-
assert_raise(RuntimeError) { patron.renew_loans() }
|
67
|
-
assert_raise(RuntimeError) { patron.renew_loans(@aleph_renew_item_id) }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
# Test patron with URL set via config
|
72
|
-
test "test patron with global config" do
|
73
|
-
Exlibris::Aleph.configure do |c|
|
74
|
-
c.base_url = "http://aleph.library.nyu.edu"
|
75
|
-
end
|
76
|
-
VCR.use_cassette('patron') do
|
77
|
-
patron = Exlibris::Aleph::Patron.new(patron_id: @nyuidn)
|
78
|
-
loans = patron.loans
|
79
|
-
assert_kind_of Array, loans
|
80
|
-
assert((not loans.empty?), "Loans empty.")
|
81
|
-
loans.each { |loan| assert_kind_of Hash, loan }
|
82
|
-
assert_nil(patron.error, "Failure in #{patron.class} while getting loans: #{patron.error}")
|
83
|
-
renew_all_loans = patron.renew_loans()
|
84
|
-
assert_kind_of Array, renew_all_loans
|
85
|
-
assert((not renew_all_loans.empty?), "Renew all loans empty.")
|
86
|
-
renew_all_loans.each { |renew_all_loan| assert_kind_of Hash, renew_all_loan }
|
87
|
-
assert_nil(patron.error, "Failure in #{patron.class} while renewing all loans: #{patron.error}")
|
88
|
-
renew_loans = patron.renew_loans(@aleph_renew_item_id)
|
89
|
-
assert_kind_of Array, renew_loans
|
90
|
-
assert((not renew_loans.empty?), "Renew loans empty.")
|
91
|
-
renew_loans.each { |renew_loan| assert_kind_of Hash, renew_loan }
|
92
|
-
assert_nil(patron.error, "Failure in #{patron.class} while renewing loan #{@aleph_renew_item_id}: #{patron.error}")
|
93
|
-
place_hold = patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location})
|
94
|
-
assert_kind_of Hash, place_hold
|
95
|
-
assert_nil(patron.error, "Failure in #{patron.class} while placing hold: #{patron.error}")
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
data/test/record_benchmarks.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
class RecordBenchmarks < ActiveSupport::TestCase
|
3
|
-
def setup
|
4
|
-
@rest_url = "http://aleph.library.nyu.edu:1891/rest-dlf"
|
5
|
-
@aleph_doc_library = "NYU01"
|
6
|
-
@aleph_doc_number = "000062856"
|
7
|
-
@bogus_url = "http://library.nyu.edu/bogus"
|
8
|
-
@TESTS = 10
|
9
|
-
end
|
10
|
-
|
11
|
-
# Get benchmarks for calls to the Aleph API.
|
12
|
-
test "benchmarks" do
|
13
|
-
# Display performance benchmarks.
|
14
|
-
time = Benchmark.bmbm do |results|
|
15
|
-
results.report("Aleph items:") { @TESTS.times {
|
16
|
-
aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
|
17
|
-
items = aleph_record.items
|
18
|
-
} }
|
19
|
-
results.report("Aleph bib and holdings:") { @TESTS.times {
|
20
|
-
aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
|
21
|
-
items = aleph_record.bib
|
22
|
-
items = aleph_record.holdings
|
23
|
-
} }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/test/record_test.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
class RecordTest < ActiveSupport::TestCase
|
3
|
-
def setup
|
4
|
-
@rest_url = "http://aleph.library.nyu.edu:1891/rest-dlf"
|
5
|
-
@aleph_doc_library = "NYU01"
|
6
|
-
@aleph_doc_number = "000062856"
|
7
|
-
@bogus_url = "http://library.nyu.edu/bogus"
|
8
|
-
end
|
9
|
-
|
10
|
-
# Test exception handling for bogus url
|
11
|
-
test "bogus_response" do
|
12
|
-
VCR.use_cassette('record bogus url') do
|
13
|
-
aleph_record = Exlibris::Aleph::Record.new(bib_library: @aleph_doc_library, record_id: @aleph_doc_number, rest_url: @bogus_url)
|
14
|
-
assert_raise(MultiXml::ParseError) { aleph_record.bib }
|
15
|
-
assert_raise(MultiXml::ParseError) { aleph_record.holdings }
|
16
|
-
assert_raise(MultiXml::ParseError) { aleph_record.items }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# Test record.
|
21
|
-
test "record" do
|
22
|
-
VCR.use_cassette('record') do
|
23
|
-
aleph_record = Exlibris::Aleph::Record.new(bib_library: @aleph_doc_library, record_id: @aleph_doc_number, rest_url: @rest_url)
|
24
|
-
bib = aleph_record.bib
|
25
|
-
assert_kind_of MARC::Record, bib
|
26
|
-
assert_equal "Travels with my aunt /", bib['245']['a']
|
27
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling bib: #{aleph_record.error}")
|
28
|
-
holdings = aleph_record.holdings
|
29
|
-
assert_kind_of Array, holdings
|
30
|
-
assert((not holdings.empty?), "Holdings empty.")
|
31
|
-
holdings.each { |holding| assert_kind_of MARC::Record, holding }
|
32
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling holdings: #{aleph_record.error}")
|
33
|
-
items = aleph_record.items
|
34
|
-
assert_kind_of Array, items
|
35
|
-
assert((not items.empty?), "Items empty.")
|
36
|
-
items.each { |item| assert_kind_of Hash, item }
|
37
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling items: #{aleph_record.error}")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# Test record.
|
42
|
-
test "record with global config" do
|
43
|
-
Exlibris::Aleph.configure do |c|
|
44
|
-
c.base_url = "http://aleph.library.nyu.edu"
|
45
|
-
end
|
46
|
-
VCR.use_cassette('record') do
|
47
|
-
aleph_record = Exlibris::Aleph::Record.new(bib_library: @aleph_doc_library, record_id: @aleph_doc_number)
|
48
|
-
bib = aleph_record.bib
|
49
|
-
assert_kind_of MARC::Record, bib
|
50
|
-
assert_equal "Travels with my aunt /", bib['245']['a']
|
51
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling bib: #{aleph_record.error}")
|
52
|
-
holdings = aleph_record.holdings
|
53
|
-
assert_kind_of Array, holdings
|
54
|
-
assert((not holdings.empty?), "Holdings empty.")
|
55
|
-
holdings.each { |holding| assert_kind_of MARC::Record, holding }
|
56
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling holdings: #{aleph_record.error}")
|
57
|
-
items = aleph_record.items
|
58
|
-
assert_kind_of Array, items
|
59
|
-
assert((not items.empty?), "Items empty.")
|
60
|
-
items.each { |item| assert_kind_of Hash, item }
|
61
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling items: #{aleph_record.error}")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
data/test/support/config.yml
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
class TabHelperBenchmarks < ActiveSupport::TestCase
|
3
|
-
def setup
|
4
|
-
Exlibris::Aleph.configure { |c|
|
5
|
-
c.adms = ["NYU50", "NYU51"]
|
6
|
-
c.tab_path = "#{File.dirname(__FILE__)}/mnt/aleph_tab"
|
7
|
-
c.yml_path = File.join(File.dirname(__FILE__), "config/aleph")
|
8
|
-
}
|
9
|
-
@TESTS = 10
|
10
|
-
end
|
11
|
-
|
12
|
-
# Get benchmarks for the Aleph TabHelper
|
13
|
-
test "benchmarks_refresh_yml" do
|
14
|
-
# Display performance benchmarks.
|
15
|
-
time = Benchmark.bmbm do |results|
|
16
|
-
results.report("TabHelper refresh_yml:") { @TESTS.times {
|
17
|
-
Exlibris::Aleph::TabHelper.refresh_yml()
|
18
|
-
} }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# Get benchmarks for the Aleph TabHelper
|
23
|
-
test "benchmarks_new" do
|
24
|
-
# Display performance benchmarks.
|
25
|
-
time = Benchmark.bmbm do |results|
|
26
|
-
results.report("TabHelper new:") { @TESTS.times {
|
27
|
-
Exlibris::Aleph::TabHelper.send(:new)
|
28
|
-
} }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Get benchmarks for the Aleph TabHelper
|
33
|
-
test "benchmarks_instance" do
|
34
|
-
Exlibris::Aleph::TabHelper.send(:new)
|
35
|
-
# Display performance benchmarks.
|
36
|
-
time = Benchmark.bmbm do |results|
|
37
|
-
results.report("TabHelper instance:") { @TESTS.times {
|
38
|
-
Exlibris::Aleph::TabHelper.instance
|
39
|
-
} }
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Get benchmarks for the Aleph TabHelper
|
44
|
-
test "benchmarks_refresh" do
|
45
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
46
|
-
# Display performance benchmarks.
|
47
|
-
time = Benchmark.bmbm do |results|
|
48
|
-
results.report("TabHelper refresh:") { @TESTS.times {
|
49
|
-
helper.send(:refresh)
|
50
|
-
} }
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
data/test/tab_helper_test.rb
DELETED
@@ -1,192 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
class TabHelperTest < ActiveSupport::TestCase
|
3
|
-
def setup
|
4
|
-
@adms = ["NYU50", "NYU51"]
|
5
|
-
@tab_path = "#{File.dirname(__FILE__)}/mnt/aleph_tab"
|
6
|
-
@yml_path = File.join(File.dirname(__FILE__), "config/aleph")
|
7
|
-
Exlibris::Aleph.configure { |c|
|
8
|
-
c.adms = @adms
|
9
|
-
c.tab_path = @tab_path
|
10
|
-
c.yml_path = @yml_path
|
11
|
-
}
|
12
|
-
@helper = Exlibris::Aleph::TabHelper.instance
|
13
|
-
end
|
14
|
-
|
15
|
-
test "configure" do
|
16
|
-
assert_equal(["nyu50", "nyu51"], @helper.adms)
|
17
|
-
assert_equal(File.join(File.dirname(__FILE__), "mnt/aleph_tab"), @helper.class.tab_path)
|
18
|
-
assert_equal(File.join(File.dirname(__FILE__), "config/aleph"), @helper.class.yml_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
test "instance" do
|
22
|
-
assert_nothing_raised() { Exlibris::Aleph::TabHelper.send(:new) }
|
23
|
-
assert_same(@helper, Exlibris::Aleph::TabHelper.instance)
|
24
|
-
end
|
25
|
-
|
26
|
-
test "refresh" do
|
27
|
-
@helper.instance_variable_set(:@refresh_time, lambda{1.second.ago})
|
28
|
-
@helper.sub_libraries
|
29
|
-
updated_at_1 = @helper.updated_at
|
30
|
-
@helper.sub_libraries
|
31
|
-
updated_at_2 = @helper.updated_at
|
32
|
-
assert_equal(updated_at_1, updated_at_2)
|
33
|
-
sleep 1
|
34
|
-
@helper.sub_libraries
|
35
|
-
assert_not_equal(updated_at_1, @helper.updated_at)
|
36
|
-
@helper.instance_variable_set(:@refresh_time, @helper.class.refresh_time)
|
37
|
-
end
|
38
|
-
|
39
|
-
test "successful refresh?" do
|
40
|
-
@helper.send(:refresh)
|
41
|
-
assert @helper.send(:successful_refresh?)
|
42
|
-
@helper.instance_variable_get(:@patrons)["nyu50"] = false
|
43
|
-
assert((not @helper.send(:successful_refresh?)))
|
44
|
-
@helper.send(:refresh)
|
45
|
-
assert @helper.send(:successful_refresh?)
|
46
|
-
end
|
47
|
-
|
48
|
-
test "sub_library_text" do
|
49
|
-
assert_equal("NYU Bobst", @helper.sub_library_text("BOBST"))
|
50
|
-
end
|
51
|
-
|
52
|
-
test "sub_library_adm" do
|
53
|
-
assert_equal("NYU50", @helper.sub_library_adm("BOBST"))
|
54
|
-
end
|
55
|
-
|
56
|
-
test "item_pickup_locations" do
|
57
|
-
assert_equal(
|
58
|
-
["BOBST", "NCOUR", "NIFA", "NISAW", "NREI", "NPOLY", "NYUAB", "NYUSE", "NYUSS"],
|
59
|
-
@helper.item_pickup_locations({:adm_library_code => "nyu50", :sub_library_code => "BOBST", :bor_status => "51"}))
|
60
|
-
end
|
61
|
-
|
62
|
-
test "collection_text" do
|
63
|
-
assert_equal(
|
64
|
-
"Main Collection",
|
65
|
-
@helper.collection_text({:adm_library_code => "nyu50", :sub_library_code => "BOBST", :collection_code => "MAIN"}))
|
66
|
-
end
|
67
|
-
|
68
|
-
test "item_web_text" do
|
69
|
-
assert_equal(
|
70
|
-
"Offsite Available",
|
71
|
-
@helper.item_web_text({:adm_library_code => "nyu50", :item_process_status => "Depository"}))
|
72
|
-
assert_equal(
|
73
|
-
"Offsite Available",
|
74
|
-
@helper.item_web_text({:adm_library_code => "nyu50", :sub_library_code => "BOBST", :item_process_status_code => "DP"}))
|
75
|
-
end
|
76
|
-
|
77
|
-
test "item_permissions" do
|
78
|
-
assert_equal("C", @helper.item_permissions(:adm_library_code => "nyu50",
|
79
|
-
:sub_library_code => "BOBST", :item_status_code => "01", :item_process_status_code => "DP")[:hold_request])
|
80
|
-
end
|
81
|
-
|
82
|
-
test "sub_libraries" do
|
83
|
-
assert_equal("BOBST", @helper.sub_libraries["BOBST"][:code])
|
84
|
-
assert_equal("NYU Bobst", @helper.sub_libraries["BOBST"][:text])
|
85
|
-
assert_equal("NYU50", @helper.sub_libraries["BOBST"][:library])
|
86
|
-
end
|
87
|
-
|
88
|
-
test "patrons" do
|
89
|
-
assert_equal("51", @helper.patrons["nyu50"]["51"][:code])
|
90
|
-
assert_equal("NYU Administrator", @helper.patrons["nyu50"]["51"][:text])
|
91
|
-
end
|
92
|
-
|
93
|
-
test "patron_permissions" do
|
94
|
-
assert_equal("BOBST", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:sub_library])
|
95
|
-
assert_equal("51", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:patron_status])
|
96
|
-
assert_equal("Y", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:loan_permission])
|
97
|
-
assert_equal("Y", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:photo_permission])
|
98
|
-
assert_equal("Y", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:override_permission])
|
99
|
-
assert_equal("N", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:multiple_hold_permission])
|
100
|
-
assert_equal("Y", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:check_loan])
|
101
|
-
assert_equal("Y", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:hold_permission])
|
102
|
-
assert_equal("Y", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:renew_permission])
|
103
|
-
assert_equal("Y", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:hold_request_permission_for_item_on_shelf])
|
104
|
-
assert_equal("N", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:loan_display])
|
105
|
-
assert_equal("N", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:reading_room_permission])
|
106
|
-
assert_equal("N", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:item_booking_permission])
|
107
|
-
assert_equal("N", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:booking_ignore_closing_hours])
|
108
|
-
assert_equal("N", @helper.patron_permissions["nyu50"]["BOBST"]["51"][:automatically_create_aleph_record])
|
109
|
-
end
|
110
|
-
|
111
|
-
test "items" do
|
112
|
-
assert_equal("ITEM-STATUS", @helper.items["nyu50"]["Billed as lost"][:code])
|
113
|
-
assert_equal("Billed as lost", @helper.items["nyu50"]["Billed as lost"][:original_text])
|
114
|
-
assert_equal("Request ILL", @helper.items["nyu50"]["Billed as lost"][:web_text])
|
115
|
-
end
|
116
|
-
|
117
|
-
test "item_permissions_by_item_status" do
|
118
|
-
assert_equal("BOBST", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:sub_library])
|
119
|
-
assert_equal("01", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:item_status])
|
120
|
-
assert_equal("Regular loan", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:text])
|
121
|
-
assert_equal("Y", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:loan])
|
122
|
-
assert_equal("Y", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:renew])
|
123
|
-
assert_equal("Y", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:hold_request])
|
124
|
-
assert_equal("N", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:photocopy_request])
|
125
|
-
assert_equal("Y", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:web_opac])
|
126
|
-
assert_equal("N", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:specific_item])
|
127
|
-
assert_equal("N", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:limit_hold])
|
128
|
-
assert_equal("Y", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:recall])
|
129
|
-
assert_equal("N", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:rush_recall])
|
130
|
-
assert_equal("N", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:booking_permission])
|
131
|
-
assert_equal("00", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:reloaning_limit])
|
132
|
-
assert_equal("A", @helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:booking_hours])
|
133
|
-
end
|
134
|
-
|
135
|
-
test "item_permissions_by_item_process_status" do
|
136
|
-
assert_equal("BOBST", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:sub_library])
|
137
|
-
assert_equal("AC", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:item_process_status])
|
138
|
-
assert_equal("AFC-Post cataloging", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:text])
|
139
|
-
assert_equal("Y", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:loan])
|
140
|
-
assert_equal("Y", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:renew])
|
141
|
-
assert_equal("Y", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:hold_request])
|
142
|
-
assert_equal("N", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:photocopy_request])
|
143
|
-
assert_equal("Y", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:web_opac])
|
144
|
-
assert_equal("Y", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:specific_item])
|
145
|
-
assert_equal("N", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:limit_hold])
|
146
|
-
assert_equal("Y", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:recall])
|
147
|
-
assert_equal("N", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:rush_recall])
|
148
|
-
assert_equal("N", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:booking_permission])
|
149
|
-
assert_equal("00", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:reloaning_limit])
|
150
|
-
assert_equal("A", @helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:booking_hours])
|
151
|
-
end
|
152
|
-
|
153
|
-
test "collections" do
|
154
|
-
assert_equal("BOBST", @helper.collections["nyu50"]["BOBST"]["MAIN"][:sub_library])
|
155
|
-
assert_equal("MAIN", @helper.collections["nyu50"]["BOBST"]["MAIN"][:collection_code])
|
156
|
-
assert_equal("Main Collection", @helper.collections["nyu50"]["BOBST"]["MAIN"][:text])
|
157
|
-
end
|
158
|
-
|
159
|
-
test "pickup_locations" do
|
160
|
-
assert_equal("BOBST", @helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:sub_library])
|
161
|
-
assert_equal("##", @helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:item_status])
|
162
|
-
assert_equal("DP", @helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:item_process_status])
|
163
|
-
assert_equal("51", @helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:patron_status])
|
164
|
-
assert_equal("Y", @helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:availability_status])
|
165
|
-
assert_equal(["BOBST", "NCOUR", "NIFA", "NISAW", "NREI", "NPOLY", "NYUAB", "NYUSE", "NYUSS"], @helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:pickup_locations])
|
166
|
-
end
|
167
|
-
|
168
|
-
test "pickup_locations on multiple lines" do
|
169
|
-
assert_equal(["BOBST", "NCOUR", "NIFA","NISAW","NREI","NPOLY","NYUAB","NBERL",
|
170
|
-
"NFLOR","NLOND","NPRAG","NWADC"], @helper.pickup_locations["nyu50"]["BOBST"]["##"]["##"]["89"]["#"][:pickup_locations])
|
171
|
-
end
|
172
|
-
|
173
|
-
test "refresh_yml" do
|
174
|
-
assert_nil(@helper.sub_libraries["NEW__"])
|
175
|
-
sub_library_file = "#{File.dirname(__FILE__)}/mnt/aleph_tab/alephe/tab/tab_sub_library.eng"
|
176
|
-
file = File.open(sub_library_file, 'r')
|
177
|
-
old_size = File.size(sub_library_file)
|
178
|
-
file.close
|
179
|
-
# Update the file.
|
180
|
-
File.open(sub_library_file, 'a') {|f| f.puts "NEW__ 1 NYU50 L NYU TEST BOBST BOBST BOBST BOBST NYU50 ALEPH" }
|
181
|
-
Exlibris::Aleph::TabHelper.refresh_yml
|
182
|
-
@helper.send(:refresh)
|
183
|
-
assert_not_nil(@helper.sub_libraries["NEW__"])
|
184
|
-
assert_equal("NEW__", @helper.sub_libraries["NEW__"][:code])
|
185
|
-
assert_equal("NYU TEST", @helper.sub_libraries["NEW__"][:text])
|
186
|
-
assert_equal("NYU50", @helper.sub_libraries["NEW__"][:library])
|
187
|
-
# Revert the file to what it was
|
188
|
-
file = File.open(sub_library_file, 'r+')
|
189
|
-
file.truncate(old_size)
|
190
|
-
file.close
|
191
|
-
end
|
192
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'coveralls'
|
2
|
-
Coveralls.wear!
|
3
|
-
require 'test/unit'
|
4
|
-
require File.expand_path("../../lib/exlibris-aleph.rb", __FILE__)
|
5
|
-
|
6
|
-
# VCR is used to 'record' HTTP interactions with
|
7
|
-
# third party services used in tests, and play em
|
8
|
-
# back. Useful for efficiency, also useful for
|
9
|
-
# testing code against API's that not everyone
|
10
|
-
# has access to -- the responses can be cached
|
11
|
-
# and re-used.
|
12
|
-
require 'vcr'
|
13
|
-
require 'webmock'
|
14
|
-
|
15
|
-
VCR.configure do |c|
|
16
|
-
c.cassette_library_dir = 'test/vcr_cassettes'
|
17
|
-
# webmock needed for HTTPClient testing
|
18
|
-
c.hook_into :webmock
|
19
|
-
# c.debug_logger = $stderr
|
20
|
-
c.filter_sensitive_data("library.edu") { "library.nyu.edu" }
|
21
|
-
end
|
22
|
-
|
23
|
-
class Test::Unit::TestCase
|
24
|
-
|
25
|
-
def yaml_aleph_configuration
|
26
|
-
Exlibris::Aleph.configure do |config|
|
27
|
-
config.load_yaml File.expand_path("../support/config.yml", __FILE__)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
protected :yaml_aleph_configuration
|
31
|
-
|
32
|
-
def reset_aleph_configuration
|
33
|
-
Exlibris::Aleph.configure do |config|
|
34
|
-
config.base_url = nil
|
35
|
-
config.rest_url = nil
|
36
|
-
config.adms = nil
|
37
|
-
config.refresh_time = nil
|
38
|
-
config.tab_path = nil
|
39
|
-
config.yml_path = nil
|
40
|
-
config.logger = nil
|
41
|
-
config.irrelevant_sub_libraries = nil
|
42
|
-
config.load_time = nil
|
43
|
-
end
|
44
|
-
end
|
45
|
-
protected :reset_aleph_configuration
|
46
|
-
end
|