exlibris-aleph 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +38 -0
- data/lib/exlibris-aleph.rb +20 -0
- data/lib/exlibris/aleph/bor_auth.rb +40 -0
- data/lib/exlibris/aleph/config/config_base.rb +49 -0
- data/lib/exlibris/aleph/config/config_by_sub_library.rb +32 -0
- data/lib/exlibris/aleph/config/pc_tab_exp_field_extended.rb +20 -0
- data/lib/exlibris/aleph/config/tab15_by_item_process_status.rb +33 -0
- data/lib/exlibris/aleph/config/tab15_by_item_status.rb +33 -0
- data/lib/exlibris/aleph/config/tab31.rb +39 -0
- data/lib/exlibris/aleph/config/tab37.rb +50 -0
- data/lib/exlibris/aleph/config/tab40.rb +20 -0
- data/lib/exlibris/aleph/config/tab_sub_library.rb +21 -0
- data/lib/exlibris/aleph/config/tab_www_item_desc.rb +20 -0
- data/lib/exlibris/aleph/patron.rb +72 -0
- data/lib/exlibris/aleph/record.rb +56 -0
- data/lib/exlibris/aleph/rest.rb +31 -0
- data/lib/exlibris/aleph/tab_helper.rb +252 -0
- data/lib/exlibris/aleph/version.rb +5 -0
- data/lib/tasks/exlibris-aleph_tasks.rake +13 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/aleph/NYU50/collections.yml +1128 -0
- data/test/dummy/config/aleph/NYU50/item_permissions_by_item_process_status.yml +71226 -0
- data/test/dummy/config/aleph/NYU50/item_permissions_by_item_status.yml +20090 -0
- data/test/dummy/config/aleph/NYU50/items.yml +609 -0
- data/test/dummy/config/aleph/NYU50/patron_permissions.yml +22687 -0
- data/test/dummy/config/aleph/NYU50/patrons.yml +245 -0
- data/test/dummy/config/aleph/NYU50/pickup_locations.yml +2049 -0
- data/test/dummy/config/aleph/NYU51/collections.yml +41 -0
- data/test/dummy/config/aleph/NYU51/item_permissions_by_item_process_status.yml +7689 -0
- data/test/dummy/config/aleph/NYU51/item_permissions_by_item_status.yml +447 -0
- data/test/dummy/config/aleph/NYU51/items.yml +617 -0
- data/test/dummy/config/aleph/NYU51/patron_permissions.yml +6496 -0
- data/test/dummy/config/aleph/NYU51/patrons.yml +233 -0
- data/test/dummy/config/aleph/NYU51/pickup_locations.yml +456 -0
- data/test/dummy/config/aleph/sub_libraries.yml +756 -0
- data/test/dummy/config/application.rb +56 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/aleph.rb +1 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/aleph/aleph_tab_helper.log +1 -0
- data/test/dummy/log/test.log +1860 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/exlibris-aleph_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- data/test/unit/bor_auth_test.rb +24 -0
- data/test/unit/patron_test.rb +37 -0
- data/test/unit/record_benchmarks.rb +26 -0
- data/test/unit/record_test.rb +28 -0
- data/test/unit/tab_helper_benchmarks.rb +56 -0
- data/test/unit/tab_helper_test.rb +180 -0
- metadata +220 -0
@@ -0,0 +1,26 @@
|
|
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>
|
@@ -0,0 +1,26 @@
|
|
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>
|
@@ -0,0 +1,25 @@
|
|
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
|
@@ -0,0 +1,6 @@
|
|
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/test_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
# Load support files
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
class BorAuthTest < ActiveSupport::TestCase
|
3
|
+
|
4
|
+
def setup
|
5
|
+
end
|
6
|
+
|
7
|
+
test "new" do
|
8
|
+
bor_auth =
|
9
|
+
Exlibris::Aleph::BorAuth.new(
|
10
|
+
"http://aleph.library.nyu.edu", "NYU50", "BOBST", "N",
|
11
|
+
"N12162279", "d4465aacaa645f2164908cd4184c09f0")
|
12
|
+
assert_nil(bor_auth.error, "Error is not nil.")
|
13
|
+
end
|
14
|
+
|
15
|
+
test "permissions" do
|
16
|
+
bor_auth =
|
17
|
+
Exlibris::Aleph::BorAuth.new(
|
18
|
+
"http://aleph.library.nyu.edu", "NYU50", "BOBST", "N",
|
19
|
+
"N12162279", "d4465aacaa645f2164908cd4184c09f0")
|
20
|
+
assert_equal("51", bor_auth.permissions[:bor_status])
|
21
|
+
assert_equal("CB", bor_auth.permissions[:bor_type])
|
22
|
+
assert_equal("Y", bor_auth.permissions[:hold_on_shelf])
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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
|
+
patron = Exlibris::Aleph::Patron.new(@nyuidn, @bogus_url)
|
18
|
+
assert_raise(MultiXml::ParseError) { patron.loans }
|
19
|
+
assert_raise(MultiXml::ParseError) { patron.renew_loans() }
|
20
|
+
assert_raise(MultiXml::ParseError) { patron.renew_loans(@aleph_renew_item_id) }
|
21
|
+
assert_raise(MultiXml::ParseError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location}) }
|
22
|
+
end
|
23
|
+
|
24
|
+
# Test patron
|
25
|
+
test "test_patron" do
|
26
|
+
patron = Exlibris::Aleph::Patron.new(@nyuidn, @rest_url)
|
27
|
+
loans = patron.loans
|
28
|
+
assert_nil(patron.error, "Failure in #{patron.class} while getting loans: #{patron.error}")
|
29
|
+
#renew_loans = patron.renew_loans()
|
30
|
+
#assert_nil(patron.error, "Failure in #{patron.class} while renewing all loans: #{patron.error}")
|
31
|
+
#renew_loans = patron.renew_loans(@aleph_renew_item_id)
|
32
|
+
#assert_nil(patron.error, "Failure in #{patron.class} while renewing loan #{@aleph_renew_item_id}: #{patron.error}")
|
33
|
+
assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {}) }
|
34
|
+
place_hold = patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location})
|
35
|
+
assert_nil(patron.error, "Failure in #{patron.class} while placing hold: #{patron.error}")
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
@@ -0,0 +1,28 @@
|
|
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
|
+
aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @bogus_url)
|
13
|
+
assert_raise(RuntimeError) { aleph_record.bib }
|
14
|
+
assert_raise(RuntimeError) { aleph_record.holdings }
|
15
|
+
assert_raise(MultiXml::ParseError) { aleph_record.items }
|
16
|
+
end
|
17
|
+
|
18
|
+
# Test record.
|
19
|
+
test "record" do
|
20
|
+
aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
|
21
|
+
bib = aleph_record.bib
|
22
|
+
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling bib: #{aleph_record.error}")
|
23
|
+
holdings = aleph_record.holdings
|
24
|
+
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling holdings: #{aleph_record.error}")
|
25
|
+
items = aleph_record.items
|
26
|
+
assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling items: #{aleph_record.error}")
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
class TabHelperBenchmarks < ActiveSupport::TestCase
|
3
|
+
def setup
|
4
|
+
@adms = ["NYU50", "NYU51"]
|
5
|
+
@tab_path = "/mnt/aleph_tab"
|
6
|
+
Exlibris::Aleph::TabHelper.class_variable_set(:@@adms, [])
|
7
|
+
[ :@@patrons_path,
|
8
|
+
:@@items_path,
|
9
|
+
:@@item_permissions_by_item_status_path,
|
10
|
+
:@@item_permissions_by_item_process_status_path,
|
11
|
+
:@@collections_path,
|
12
|
+
:@@pickup_locations_path ].each { |class_variable|
|
13
|
+
Exlibris::Aleph::TabHelper.class_variable_set(class_variable, {}) }
|
14
|
+
@TESTS = 10
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get benchmarks for the Aleph TabHelper
|
18
|
+
test "benchmarks_init" do
|
19
|
+
# Display performance benchmarks.
|
20
|
+
time = Benchmark.bmbm do |results|
|
21
|
+
results.report("TabHelper init:") { @TESTS.times {
|
22
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
23
|
+
} }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Get benchmarks for the Aleph TabHelper
|
28
|
+
test "benchmarks_new" do
|
29
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
30
|
+
# Display performance benchmarks.
|
31
|
+
time = Benchmark.bmbm do |results|
|
32
|
+
results.report("TabHelper new:") { @TESTS.times {
|
33
|
+
[ :@@patrons_path,
|
34
|
+
:@@items_path,
|
35
|
+
:@@item_permissions_by_item_status_path,
|
36
|
+
:@@item_permissions_by_item_process_status_path,
|
37
|
+
:@@collections_path,
|
38
|
+
:@@pickup_locations_path ].each { |class_variable|
|
39
|
+
Exlibris::Aleph::TabHelper.class_variable_set(class_variable, {}) }
|
40
|
+
Exlibris::Aleph::TabHelper.send(:new)
|
41
|
+
} }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Get benchmarks for the Aleph TabHelper
|
46
|
+
test "benchmarks_refresh" do
|
47
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
|
48
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
49
|
+
# Display performance benchmarks.
|
50
|
+
time = Benchmark.bmbm do |results|
|
51
|
+
results.report("TabHelper refresh:") { @TESTS.times {
|
52
|
+
helper.refresh
|
53
|
+
} }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
class ConfigHelperTest < ActiveSupport::TestCase
|
3
|
+
def setup
|
4
|
+
Exlibris::Aleph::TabHelper.class_variable_set(:@@adms, [])
|
5
|
+
[ :@@patrons_path,
|
6
|
+
:@@items_path,
|
7
|
+
:@@item_permissions_by_item_status_path,
|
8
|
+
:@@item_permissions_by_item_process_status_path,
|
9
|
+
:@@collections_path,
|
10
|
+
:@@pickup_locations_path ].each do |class_variable|
|
11
|
+
Exlibris::Aleph::TabHelper.class_variable_set(class_variable, {})
|
12
|
+
end
|
13
|
+
@adms = ["NYU50", "NYU51"]
|
14
|
+
@tab_path = "/mnt/aleph_tab"
|
15
|
+
dummy_path = "#{File.dirname(__FILE__)}/../dummy"
|
16
|
+
@yml_path = File.join(dummy_path, "config/aleph")
|
17
|
+
@log_path = File.join(dummy_path, "log/aleph")
|
18
|
+
end
|
19
|
+
|
20
|
+
test "instance_with_no_init" do
|
21
|
+
assert_raise(ArgumentError) { Exlibris::Aleph::TabHelper.send(:new) }
|
22
|
+
end
|
23
|
+
|
24
|
+
test "init" do
|
25
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
26
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
27
|
+
assert_equal(@adms, helper.adms)
|
28
|
+
end
|
29
|
+
|
30
|
+
test "instance" do
|
31
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
32
|
+
assert_nothing_raised() { Exlibris::Aleph::TabHelper.send(:new) }
|
33
|
+
assert_same(Exlibris::Aleph::TabHelper.instance, Exlibris::Aleph::TabHelper.instance)
|
34
|
+
end
|
35
|
+
|
36
|
+
test "sub_libraries" do
|
37
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
38
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
39
|
+
assert_equal("BOBST", helper.sub_libraries["BOBST"][:code])
|
40
|
+
assert_equal("NYU Bobst", helper.sub_libraries["BOBST"][:text])
|
41
|
+
assert_equal("NYU50", helper.sub_libraries["BOBST"][:library])
|
42
|
+
end
|
43
|
+
|
44
|
+
test "patrons" do
|
45
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
46
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
47
|
+
assert_equal("51", helper.patrons["nyu50"]["51"][:code])
|
48
|
+
assert_equal("NYU Administrator", helper.patrons["nyu50"]["51"][:text])
|
49
|
+
end
|
50
|
+
|
51
|
+
test "patron_permissions" do
|
52
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
53
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
54
|
+
assert_equal("BOBST", helper.patron_permissions["nyu50"]["BOBST"]["51"][:sub_library])
|
55
|
+
assert_equal("51", helper.patron_permissions["nyu50"]["BOBST"]["51"][:patron_status])
|
56
|
+
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:loan_permission])
|
57
|
+
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:photo_permission])
|
58
|
+
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:override_permission])
|
59
|
+
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:multiple_hold_permission])
|
60
|
+
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:check_loan])
|
61
|
+
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:hold_permission])
|
62
|
+
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:renew_permission])
|
63
|
+
assert_equal("Y", helper.patron_permissions["nyu50"]["BOBST"]["51"][:hold_request_permission_for_item_on_shelf])
|
64
|
+
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:loan_display])
|
65
|
+
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:reading_room_permission])
|
66
|
+
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:item_booking_permission])
|
67
|
+
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:booking_ignore_closing_hours])
|
68
|
+
assert_equal("N", helper.patron_permissions["nyu50"]["BOBST"]["51"][:automatically_create_aleph_record])
|
69
|
+
end
|
70
|
+
|
71
|
+
test "items" do
|
72
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
73
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
74
|
+
assert_equal("ITEM-STATUS", helper.items["nyu50"]["Billed as lost"][:code])
|
75
|
+
assert_equal("Billed as lost", helper.items["nyu50"]["Billed as lost"][:original_text])
|
76
|
+
assert_equal("Request ILL", helper.items["nyu50"]["Billed as lost"][:web_text])
|
77
|
+
end
|
78
|
+
|
79
|
+
test "item_permissions_by_item_status" do
|
80
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
81
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
82
|
+
assert_equal("BOBST", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:sub_library])
|
83
|
+
assert_equal("01", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:item_status])
|
84
|
+
assert_equal("Regular loan", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:text])
|
85
|
+
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:loan])
|
86
|
+
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:renew])
|
87
|
+
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:hold_request])
|
88
|
+
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:photocopy_request])
|
89
|
+
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:web_opac])
|
90
|
+
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:specific_item])
|
91
|
+
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:limit_hold])
|
92
|
+
assert_equal("Y", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:recall])
|
93
|
+
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:rush_recall])
|
94
|
+
assert_equal("N", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:booking_permission])
|
95
|
+
assert_equal("00", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:reloaning_limit])
|
96
|
+
assert_equal("A", helper.item_permissions_by_item_status["nyu50"]["BOBST"]["01"][:booking_hours])
|
97
|
+
end
|
98
|
+
|
99
|
+
test "item_permissions_by_item_process_status" do
|
100
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
101
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
102
|
+
assert_equal("BOBST", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:sub_library])
|
103
|
+
assert_equal("AC", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:item_process_status])
|
104
|
+
assert_equal("AFC-Post cataloging", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:text])
|
105
|
+
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:loan])
|
106
|
+
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:renew])
|
107
|
+
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:hold_request])
|
108
|
+
assert_equal("N", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:photocopy_request])
|
109
|
+
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:web_opac])
|
110
|
+
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:specific_item])
|
111
|
+
assert_equal("N", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:limit_hold])
|
112
|
+
assert_equal("Y", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:recall])
|
113
|
+
assert_equal("N", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:rush_recall])
|
114
|
+
assert_equal("N", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:booking_permission])
|
115
|
+
assert_equal("00", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:reloaning_limit])
|
116
|
+
assert_equal("A", helper.item_permissions_by_item_process_status["nyu50"]["BOBST"]["AC"][:booking_hours])
|
117
|
+
end
|
118
|
+
|
119
|
+
test "collections" do
|
120
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
121
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
122
|
+
assert_equal("BOBST", helper.collections["nyu50"]["BOBST"]["MAIN"][:sub_library])
|
123
|
+
assert_equal("MAIN", helper.collections["nyu50"]["BOBST"]["MAIN"][:collection_code])
|
124
|
+
assert_equal("Main Collection", helper.collections["nyu50"]["BOBST"]["MAIN"][:text])
|
125
|
+
end
|
126
|
+
|
127
|
+
test "pickup_locations" do
|
128
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
129
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
130
|
+
assert_equal("BOBST", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:sub_library])
|
131
|
+
assert_equal("##", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:item_status])
|
132
|
+
assert_equal("DP", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:item_process_status])
|
133
|
+
assert_equal("51", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:patron_status])
|
134
|
+
assert_equal("Y", helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:availability_status])
|
135
|
+
assert_equal(["BOBST", "NCOUR", "NIFA", "NISAW", "NREI", "NPOLY", "NYUAB", "NYUSE", "NYUSS"], helper.pickup_locations["nyu50"]["BOBST"]["##"]["DP"]["51"]["Y"][:pickup_locations])
|
136
|
+
end
|
137
|
+
|
138
|
+
test "refresh_yml" do
|
139
|
+
Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
140
|
+
helper = Exlibris::Aleph::TabHelper.instance
|
141
|
+
assert_nil(helper.sub_libraries["NEW__"])
|
142
|
+
sub_library_file = "/mnt/aleph_tab/alephe/tab/tab_sub_library.eng"
|
143
|
+
file = File.open(sub_library_file, 'r')
|
144
|
+
old_size = file.size
|
145
|
+
file.close
|
146
|
+
# Update the file.
|
147
|
+
File.open(sub_library_file, 'a') {|f| f.puts "NEW__ 1 NYU50 L NYU TEST BOBST BOBST BOBST BOBST NYU50 ALEPH" }
|
148
|
+
Exlibris::Aleph::TabHelper.refresh_yml
|
149
|
+
helper.refresh
|
150
|
+
assert_not_nil(helper.sub_libraries["NEW__"])
|
151
|
+
assert_equal("NEW__", helper.sub_libraries["NEW__"][:code])
|
152
|
+
assert_equal("NYU TEST", helper.sub_libraries["NEW__"][:text])
|
153
|
+
assert_equal("NYU50", helper.sub_libraries["NEW__"][:library])
|
154
|
+
# Revert the file to what it was
|
155
|
+
file = File.open(sub_library_file, 'r+')
|
156
|
+
file.truncate(old_size)
|
157
|
+
file.close
|
158
|
+
end
|
159
|
+
|
160
|
+
# test "refresh" do
|
161
|
+
# Exlibris::Aleph::TabHelper.init(@tab_path, @yml_path, @log_path, @adms)
|
162
|
+
# helper = Exlibris::Aleph::TabHelper.instance
|
163
|
+
# assert_nil(helper.sub_libraries["NEW__"])
|
164
|
+
# sub_library_file = "/mnt/aleph_tab/alephe/tab/tab_sub_library.eng"
|
165
|
+
# file = File.open(sub_library_file, 'r')
|
166
|
+
# old_size = file.size
|
167
|
+
# file.close
|
168
|
+
# # Update the file.
|
169
|
+
# File.open(sub_library_file, 'a') {|f| f.puts "NEW__ 1 NYU50 L NYU TEST BOBST BOBST BOBST BOBST NYU50 ALEPH" }
|
170
|
+
# helper.refresh
|
171
|
+
# assert_not_nil(helper.sub_libraries["NEW__"])
|
172
|
+
# assert_equal("NEW__", helper.sub_libraries["NEW__"][:code])
|
173
|
+
# assert_equal("NYU TEST", helper.sub_libraries["NEW__"][:text])
|
174
|
+
# assert_equal("NYU50", helper.sub_libraries["NEW__"][:library])
|
175
|
+
# # Revert the file to what it was
|
176
|
+
# file = File.open(sub_library_file, 'r+')
|
177
|
+
# file.truncate(old_size)
|
178
|
+
# file.close
|
179
|
+
# end
|
180
|
+
end
|