exlibris-aleph 0.1.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +89 -0
- data/Rakefile +2 -4
- data/lib/exlibris-aleph.rb +8 -21
- data/lib/exlibris/aleph.rb +13 -0
- data/lib/exlibris/aleph/abstract.rb +28 -0
- data/lib/exlibris/aleph/config.rb +78 -0
- data/lib/exlibris/aleph/patron.rb +71 -56
- data/lib/exlibris/aleph/record.rb +34 -40
- data/lib/exlibris/aleph/rest/base.rb +56 -0
- data/lib/exlibris/aleph/tab_helper.rb +84 -99
- data/lib/exlibris/aleph/{config/config_base.rb → tabs_parser/base.rb} +2 -2
- data/lib/exlibris/aleph/{config → tabs_parser}/pc_tab_exp_field_extended.rb +2 -2
- data/lib/exlibris/aleph/{config/config_by_sub_library.rb → tabs_parser/sub_library.rb} +2 -2
- data/lib/exlibris/aleph/{config → tabs_parser}/tab15_by_item_process_status.rb +2 -2
- data/lib/exlibris/aleph/{config → tabs_parser}/tab15_by_item_status.rb +2 -2
- data/lib/exlibris/aleph/{config → tabs_parser}/tab31.rb +2 -2
- data/lib/exlibris/aleph/{config → tabs_parser}/tab37.rb +2 -2
- data/lib/exlibris/aleph/{config → tabs_parser}/tab40.rb +2 -2
- data/lib/exlibris/aleph/{config → tabs_parser}/tab_sub_library.rb +2 -2
- data/lib/exlibris/aleph/{config → tabs_parser}/tab_www_item_desc.rb +2 -2
- data/lib/exlibris/aleph/task_installer.rb +23 -0
- data/lib/exlibris/aleph/version.rb +1 -1
- data/lib/exlibris/aleph/write_attributes.rb +38 -0
- data/lib/exlibris/aleph/xml_util.rb +50 -0
- data/lib/exlibris/aleph/xservice/bor_auth.rb +47 -0
- data/lib/tasks/exlibris-aleph_tasks.rake +1 -8
- data/test/{dummy/config → config}/aleph/alephe/sub_libraries.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu50/collections.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu50/item_permissions_by_item_process_status.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu50/item_permissions_by_item_status.yml +104 -105
- data/test/{dummy/config → config}/aleph/nyu50/items.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu50/patron_permissions.yml +27 -28
- data/test/{dummy/config → config}/aleph/nyu50/patrons.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu50/pickup_locations.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu51/collections.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu51/item_permissions_by_item_process_status.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu51/item_permissions_by_item_status.yml +6 -7
- data/test/{dummy/config → config}/aleph/nyu51/items.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu51/patron_permissions.yml +27 -28
- data/test/{dummy/config → config}/aleph/nyu51/patrons.yml +0 -1
- data/test/{dummy/config → config}/aleph/nyu51/pickup_locations.yml +0 -1
- data/test/config_test.rb +24 -0
- data/test/patron_test.rb +98 -0
- data/test/{unit/record_benchmarks.rb → record_benchmarks.rb} +0 -0
- data/test/record_test.rb +64 -0
- data/test/support/config.yml +2 -0
- data/test/{unit/tab_helper_benchmarks.rb → tab_helper_benchmarks.rb} +5 -20
- data/test/tab_helper_test.rb +178 -0
- data/test/test_helper.rb +26 -22
- data/test/vcr_cassettes/bor_auth.yml +8 -10
- data/test/vcr_cassettes/patron.yml +77 -18
- data/test/vcr_cassettes/patron_address.yml +45 -0
- data/test/vcr_cassettes/patron_bogus_url.yml +731 -0
- data/test/vcr_cassettes/patron_error.yml +93 -0
- data/test/vcr_cassettes/record.yml +18 -17
- data/test/vcr_cassettes/record_bogus_url.yml +690 -0
- data/test/{unit → xservice}/bor_auth_test.rb +4 -4
- metadata +160 -150
- data/README.rdoc +0 -67
- data/lib/exlibris/aleph/bor_auth.rb +0 -45
- data/lib/exlibris/aleph/railtie.rb +0 -9
- data/lib/exlibris/aleph/rest.rb +0 -43
- data/lib/exlibris/aleph/tasks.rb +0 -25
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -56
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/aleph.rb +0 -1
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/db/README +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/aleph/aleph_tab_helper.log +0 -1
- data/test/dummy/log/aleph/tab_helper.log +0 -109
- data/test/dummy/log/tab_helper.log +0 -16
- data/test/dummy/log/test.log +0 -5160
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/unit/patron_test.rb +0 -41
- data/test/unit/record_test.rb +0 -32
- data/test/unit/tab_helper_test.rb +0 -222
data/test/dummy/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
</div>
|
24
|
-
</body>
|
25
|
-
</html>
|
File without changes
|
data/test/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
data/test/unit/patron_test.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
class PatronTest < 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
|
-
@nyuidn = "N12162279"
|
8
|
-
@aleph_adm_library = "NYU50"
|
9
|
-
@aleph_item_id = "NYU50000062856000010"
|
10
|
-
@aleph_renew_item_id = "NYU50000647049"
|
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.turned_off do
|
18
|
-
patron = Exlibris::Aleph::Patron.new(@nyuidn, @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(@nyuidn, @rest_url)
|
30
|
-
loans = patron.loans
|
31
|
-
assert_nil(patron.error, "Failure in #{patron.class} while getting loans: #{patron.error}")
|
32
|
-
#renew_loans = patron.renew_loans()
|
33
|
-
#assert_nil(patron.error, "Failure in #{patron.class} while renewing all loans: #{patron.error}")
|
34
|
-
#renew_loans = patron.renew_loans(@aleph_renew_item_id)
|
35
|
-
#assert_nil(patron.error, "Failure in #{patron.class} while renewing loan #{@aleph_renew_item_id}: #{patron.error}")
|
36
|
-
assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {}) }
|
37
|
-
place_hold = patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location})
|
38
|
-
assert_nil(patron.error, "Failure in #{patron.class} while placing hold: #{patron.error}")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/test/unit/record_test.rb
DELETED
@@ -1,32 +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.turned_off do
|
13
|
-
aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @bogus_url)
|
14
|
-
assert_raise(RuntimeError) { aleph_record.bib }
|
15
|
-
assert_raise(RuntimeError) { 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(@aleph_doc_library, @aleph_doc_number, @rest_url)
|
24
|
-
bib = aleph_record.bib
|
25
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling bib: #{aleph_record.error}")
|
26
|
-
holdings = aleph_record.holdings
|
27
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling holdings: #{aleph_record.error}")
|
28
|
-
items = aleph_record.items
|
29
|
-
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling items: #{aleph_record.error}")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,222 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
class ConfigHelperTest < ActiveSupport::TestCase
|
3
|
-
def setup
|
4
|
-
Exlibris::Aleph::TabHelper.send(:class_variable_set, :@@adms, [])
|
5
|
-
Exlibris::Aleph::TabHelper.send(:class_variable_set, :@@refresh_time, lambda{1.day.ago})
|
6
|
-
@adms = ["NYU50", "NYU51"]
|
7
|
-
@tab_path = "#{Rails.root}/../mnt/aleph_tab"
|
8
|
-
dummy_path = "#{File.dirname(__FILE__)}/../dummy"
|
9
|
-
@yml_path = File.join(dummy_path, "config/aleph")
|
10
|
-
@log_path = File.join(dummy_path, "log/aleph")
|
11
|
-
end
|
12
|
-
|
13
|
-
test "instance_with_no_init" do
|
14
|
-
assert_raise(ArgumentError) { Exlibris::Aleph::TabHelper.send(:new) }
|
15
|
-
end
|
16
|
-
|
17
|
-
test "instance_with_wrong_init" do
|
18
|
-
Exlibris::Aleph::TabHelper.init(nil, nil)
|
19
|
-
assert_raise(ArgumentError) { Exlibris::Aleph::TabHelper.send(:new) }
|
20
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, nil)
|
21
|
-
assert_raise(ArgumentError) { Exlibris::Aleph::TabHelper.send(:new) }
|
22
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, [])
|
23
|
-
assert_raise(ArgumentError) { Exlibris::Aleph::TabHelper.send(:new) }
|
24
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms, nil)
|
25
|
-
assert_raise(ArgumentError) { Exlibris::Aleph::TabHelper.send(:new) }
|
26
|
-
end
|
27
|
-
|
28
|
-
test "init" do
|
29
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
30
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
31
|
-
assert_equal(["nyu50", "nyu51"], helper.adms)
|
32
|
-
end
|
33
|
-
|
34
|
-
test "instance" do
|
35
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
36
|
-
assert_nothing_raised() { Exlibris::Aleph::TabHelper.send(:new) }
|
37
|
-
assert_same(Exlibris::Aleph::TabHelper.instance, Exlibris::Aleph::TabHelper.instance)
|
38
|
-
end
|
39
|
-
|
40
|
-
test "refresh" do
|
41
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms, lambda{1.second.ago})
|
42
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
43
|
-
helper.sub_libraries
|
44
|
-
updated_at_1 = helper.updated_at
|
45
|
-
helper.sub_libraries
|
46
|
-
updated_at_2 = helper.updated_at
|
47
|
-
assert_equal(updated_at_1, updated_at_2)
|
48
|
-
sleep 1
|
49
|
-
helper.sub_libraries
|
50
|
-
assert_not_equal(updated_at_1, helper.updated_at)
|
51
|
-
end
|
52
|
-
|
53
|
-
test "sub_library_text" do
|
54
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
55
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
56
|
-
assert_equal("NYU Bobst", helper.sub_library_text("BOBST"))
|
57
|
-
end
|
58
|
-
|
59
|
-
test "sub_library_adm" do
|
60
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
61
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
62
|
-
assert_equal("NYU50", helper.sub_library_adm("BOBST"))
|
63
|
-
end
|
64
|
-
|
65
|
-
test "item_pickup_locations" do
|
66
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
67
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
68
|
-
assert_equal(
|
69
|
-
["BOBST", "NCOUR", "NIFA", "NISAW", "NREI", "NPOLY", "NYUAB", "NYUSE", "NYUSS"],
|
70
|
-
helper.item_pickup_locations({:adm_library_code => "nyu50", :sub_library_code => "BOBST", :bor_status => "51"}))
|
71
|
-
end
|
72
|
-
|
73
|
-
test "collection_text" do
|
74
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
75
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
76
|
-
assert_equal(
|
77
|
-
"Main Collection",
|
78
|
-
helper.collection_text({:adm_library_code => "nyu50", :sub_library_code => "BOBST", :collection_code => "MAIN"}))
|
79
|
-
end
|
80
|
-
|
81
|
-
test "item_web_text" do
|
82
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
83
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
84
|
-
assert_equal(
|
85
|
-
"Offsite Available",
|
86
|
-
helper.item_web_text({:adm_library_code => "nyu50", :item_process_status => "Depository"}))
|
87
|
-
assert_equal(
|
88
|
-
"Offsite Available",
|
89
|
-
helper.item_web_text({:adm_library_code => "nyu50", :sub_library_code => "BOBST", :item_process_status_code => "DP"}))
|
90
|
-
end
|
91
|
-
|
92
|
-
test "sub_libraries" do
|
93
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
94
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
95
|
-
assert_equal("BOBST", helper.sub_libraries["BOBST"][:code])
|
96
|
-
assert_equal("NYU Bobst", helper.sub_libraries["BOBST"][:text])
|
97
|
-
assert_equal("NYU50", helper.sub_libraries["BOBST"][:library])
|
98
|
-
end
|
99
|
-
|
100
|
-
test "patrons" do
|
101
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
102
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
103
|
-
assert_equal("51", helper.patrons["nyu50"]["51"][:code])
|
104
|
-
assert_equal("NYU Administrator", helper.patrons["nyu50"]["51"][:text])
|
105
|
-
end
|
106
|
-
|
107
|
-
test "patron_permissions" do
|
108
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
109
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
110
|
-
assert_equal("BOBST", helper.patron_permissions["nyu50"]["BOBST"]["51"][:sub_library])
|
111
|
-
assert_equal("51", helper.patron_permissions["nyu50"]["BOBST"]["51"][:patron_status])
|
112
|
-
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:loan_permission])
|
113
|
-
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:photo_permission])
|
114
|
-
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:override_permission])
|
115
|
-
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:multiple_hold_permission])
|
116
|
-
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:check_loan])
|
117
|
-
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:hold_permission])
|
118
|
-
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:renew_permission])
|
119
|
-
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:hold_request_permission_for_item_on_shelf])
|
120
|
-
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:loan_display])
|
121
|
-
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:reading_room_permission])
|
122
|
-
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:item_booking_permission])
|
123
|
-
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:booking_ignore_closing_hours])
|
124
|
-
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:automatically_create_aleph_record])
|
125
|
-
end
|
126
|
-
|
127
|
-
test "items" do
|
128
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
129
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
130
|
-
assert_equal("ITEM-STATUS", helper.items["nyu50"]["Billed as lost"][:code])
|
131
|
-
assert_equal("Billed as lost", helper.items["nyu50"]["Billed as lost"][:original_text])
|
132
|
-
assert_equal("Request ILL", helper.items["nyu50"]["Billed as lost"][:web_text])
|
133
|
-
end
|
134
|
-
|
135
|
-
test "item_permissions_by_item_status" do
|
136
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
137
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
138
|
-
assert_equal("BOBST", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:sub_library])
|
139
|
-
assert_equal("01", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:item_status])
|
140
|
-
assert_equal("Regular loan", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:text])
|
141
|
-
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:loan])
|
142
|
-
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:renew])
|
143
|
-
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:hold_request])
|
144
|
-
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:photocopy_request])
|
145
|
-
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:web_opac])
|
146
|
-
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:specific_item])
|
147
|
-
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:limit_hold])
|
148
|
-
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:recall])
|
149
|
-
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:rush_recall])
|
150
|
-
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:booking_permission])
|
151
|
-
assert_equal("00", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:reloaning_limit])
|
152
|
-
assert_equal("A", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:booking_hours])
|
153
|
-
end
|
154
|
-
|
155
|
-
test "item_permissions_by_item_process_status" do
|
156
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
157
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
158
|
-
assert_equal("BOBST", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:sub_library])
|
159
|
-
assert_equal("AC", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:item_process_status])
|
160
|
-
assert_equal("AFC-Post cataloging", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:text])
|
161
|
-
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:loan])
|
162
|
-
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:renew])
|
163
|
-
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:hold_request])
|
164
|
-
assert_equal("N", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:photocopy_request])
|
165
|
-
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:web_opac])
|
166
|
-
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:specific_item])
|
167
|
-
assert_equal("N", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:limit_hold])
|
168
|
-
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:recall])
|
169
|
-
assert_equal("N", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:rush_recall])
|
170
|
-
assert_equal("N", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:booking_permission])
|
171
|
-
assert_equal("00", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:reloaning_limit])
|
172
|
-
assert_equal("A", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:booking_hours])
|
173
|
-
end
|
174
|
-
|
175
|
-
test "collections" do
|
176
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
177
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
178
|
-
assert_equal("BOBST", helper.collections["nyu50"]["BOBST"]["MAIN"][:sub_library])
|
179
|
-
assert_equal("MAIN", helper.collections["nyu50"]["BOBST"]["MAIN"][:collection_code])
|
180
|
-
assert_equal("Main Collection", helper.collections["nyu50"]["BOBST"]["MAIN"][:text])
|
181
|
-
end
|
182
|
-
|
183
|
-
test "pickup_locations" do
|
184
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
185
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
186
|
-
assert_equal("BOBST", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:sub_library])
|
187
|
-
assert_equal("##", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:item_status])
|
188
|
-
assert_equal("DP", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:item_process_status])
|
189
|
-
assert_equal("51", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:patron_status])
|
190
|
-
assert_equal("Y", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:availability_status])
|
191
|
-
assert_equal(["BOBST", "NCOUR", "NIFA", "NISAW", "NREI", "NPOLY", "NYUAB", "NYUSE", "NYUSS"], helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:pickup_locations])
|
192
|
-
end
|
193
|
-
|
194
|
-
test "pickup_locations on multiple lines" do
|
195
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
196
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
197
|
-
assert_equal(["BOBST", "NCOUR", "NIFA","NISAW","NREI","NPOLY","NYUAB","NBERL",
|
198
|
-
"NFLOR","NLOND","NPRAG","NWADC"], helper.pickup_locations["nyu50"]["BOBST"]["##"]["##"]["89"]["#"][:pickup_locations])
|
199
|
-
end
|
200
|
-
|
201
|
-
test "refresh_yml" do
|
202
|
-
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
203
|
-
helper = Exlibris::Aleph::TabHelper.instance
|
204
|
-
assert_nil(helper.sub_libraries["NEW__"])
|
205
|
-
sub_library_file = "#{Rails.root}/../mnt/aleph_tab/alephe/tab/tab_sub_library.eng"
|
206
|
-
file = File.open(sub_library_file, 'r')
|
207
|
-
old_size = File.size(sub_library_file)
|
208
|
-
file.close
|
209
|
-
# Update the file.
|
210
|
-
File.open(sub_library_file, 'a') {|f| f.puts "NEW__ 1 NYU50 L NYU TEST BOBST BOBST BOBST BOBST NYU50 ALEPH" }
|
211
|
-
Exlibris::Aleph::TabHelper.refresh_yml
|
212
|
-
helper.send(:refresh)
|
213
|
-
assert_not_nil(helper.sub_libraries["NEW__"])
|
214
|
-
assert_equal("NEW__", helper.sub_libraries["NEW__"][:code])
|
215
|
-
assert_equal("NYU TEST", helper.sub_libraries["NEW__"][:text])
|
216
|
-
assert_equal("NYU50", helper.sub_libraries["NEW__"][:library])
|
217
|
-
# Revert the file to what it was
|
218
|
-
file = File.open(sub_library_file, 'r+')
|
219
|
-
file.truncate(old_size)
|
220
|
-
file.close
|
221
|
-
end
|
222
|
-
end
|