]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/perlmods/t/18-OpenILS-WWW-SuperCat.t
LP#1796945 Reporter cloning and creation fixes
[working/Evergreen.git] / Open-ILS / src / perlmods / t / 18-OpenILS-WWW-SuperCat.t
1 #!perl -T
2
3 use Test::More tests => 10;
4 use Test::Output;
5
6 BEGIN {
7         use_ok( 'OpenILS::WWW::SuperCat' );
8 }
9 use_ok( 'OpenILS::WWW::SuperCat::Feed' );
10 use_ok( 'OpenILS::Utils::TagURI' );
11
12 my $tag = 'tag::U2@bre/454{holdings_xml}';
13 my $u = OpenILS::Utils::TagURI->new($tag);
14 is( $u->id,        454,   'parsed correct ID' );
15 is( $u->classname, 'bre', 'parsed correct class name' );
16 is( $u->toURI,     $tag,  'can reconstruct unAPI ID' );
17
18 my $apache_stub;
19 stdout_like { OpenILS::WWW::SuperCat::unapi2_formats($apache_stub, $u) }
20             qr/marcxml/,
21             'U2 formats list for bre includes marcxml';
22
23 stdout_unlike { OpenILS::WWW::SuperCat::unapi2_formats($apache_stub, $u) }
24               qr/name="xml"/,
25               'U2 formats list for bre does not include xml';
26
27 my $u2 = OpenILS::Utils::TagURI->new('tag::U2@acn/4');
28 stdout_like { OpenILS::WWW::SuperCat::unapi2_formats($apache_stub, $u2) }
29             qr/name="xml"/,
30             'U2 formats list for acn does includes xml';
31 stdout_unlike { OpenILS::WWW::SuperCat::unapi2_formats($apache_stub, $u2) }
32               qr/name="marcxml"/,
33               'U2 formats list for acn does not includes marcxml';