Bug 9302: Use patron-title.inc
[koha.git] / t / External / BakerTaylor.t
blobcbaa56e27352aad7c408c8e6ffa5c92d74c39229
1 #!/usr/bin/perl
3 # some simple tests of the elements of C4::External::BakerTaylor that do not require a valid username and password
5 use Modern::Perl;
7 use Test::More tests => 9;
8 use t::lib::Mocks;
10 BEGIN {
11 use_ok('C4::External::BakerTaylor');
14 # test with mocked prefs
15 my $username= "testing_username";
16 my $password= "testing_password";
17 my $link_url = "http://wrongexample.com?ContentCafe.aspx?UserID=$username";
19 t::lib::Mocks::mock_preference( 'BakerTaylorUsername', $username );
20 t::lib::Mocks::mock_preference( 'BakerTaylorPassword', $password );
21 t::lib::Mocks::mock_preference( 'BakerTaylorBookstoreURL', $link_url );
23 my $image_url = "http://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$username&Password=$password&Options=Y&Return=T&Type=S&Value=";
24 my $content_cafe = "http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$username&Password=$password&Options=Y&ItemKey=";
26 is( C4::External::BakerTaylor::image_url(), $image_url, "testing default image url");
27 is( C4::External::BakerTaylor::image_url("aa"), $image_url."aa", "testing image url construction");
28 is( C4::External::BakerTaylor::link_url(), $link_url, "testing default link url");
29 is( C4::External::BakerTaylor::link_url("bb"), "${link_url}bb", "testing link url construction");
30 is( C4::External::BakerTaylor::content_cafe_url(""), $content_cafe, "testing default content cafe url");
31 is( C4::External::BakerTaylor::content_cafe_url("cc"), "${content_cafe}cc", "testing content cafe url construction");
32 is( C4::External::BakerTaylor::http_jacket_link(""), undef, "testing empty http jacket link");
33 is( C4::External::BakerTaylor::availability(""), undef, "testing empty availability");