Lines 1-14
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
# |
2 |
|
3 |
# This Koha test module is a stub! |
3 |
# some simple tests of the elements of C4::External::BakerTaylor that do not require a valid username and password |
4 |
# Add more tests here!!! |
|
|
5 |
|
4 |
|
6 |
use strict; |
5 |
use strict; |
7 |
use warnings; |
6 |
use warnings; |
8 |
|
7 |
|
9 |
use Test::More tests => 1; |
8 |
use Test::More tests => 9; |
10 |
|
9 |
|
11 |
BEGIN { |
10 |
BEGIN { |
12 |
use_ok('C4::External::BakerTaylor'); |
11 |
use_ok('C4::External::BakerTaylor'); |
13 |
} |
12 |
} |
14 |
|
13 |
|
15 |
- |
14 |
# for testing, to avoid using C4::Context |
|
|
15 |
my $username="testing_username"; |
16 |
my $password="testing_password"; |
17 |
|
18 |
# taken from C4::External::BakerTaylor::initialize |
19 |
my $image_url = "http://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$username&Password=$password&Options=Y&Return=T&Type=S&Value="; |
20 |
|
21 |
# test without initializing |
22 |
is( C4::External::BakerTaylor::image_url(), undef, "testing image url pre initilization"); |
23 |
is( C4::External::BakerTaylor::link_url(), undef, "testing link url pre initilization"); |
24 |
is( C4::External::BakerTaylor::content_cafe_url(""), undef, "testing content cafe url pre initilization"); |
25 |
is( C4::External::BakerTaylor::http_jacket_link(""), undef, "testing http jacket link pre initilization"); |
26 |
is( C4::External::BakerTaylor::availability(""), undef, "testing availability pre initilization"); |
27 |
|
28 |
# intitialize |
29 |
C4::External::BakerTaylor::initialize($username, $password, "link_url"); |
30 |
|
31 |
# testing basic results |
32 |
is( C4::External::BakerTaylor::image_url("aa"), $image_url."aa", "testing image url construction"); |
33 |
is( C4::External::BakerTaylor::link_url("bb"), "link_urlbb", "testing link url construction"); |
34 |
is( C4::External::BakerTaylor::content_cafe_url("cc"), "http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$username&Password=$password&Options=Y&ItemKey=cc", "testing content cafe url construction"); |