]> git.evergreen-ils.org Git - working/NCIPServer.git/blob - t/NCIP.t
Starting work on ILS dependent code
[working/NCIPServer.git] / t / NCIP.t
1 #
2 #===============================================================================
3 #
4 #         FILE: NCIP.t
5 #
6 #  DESCRIPTION:
7 #
8 #        FILES: ---
9 #         BUGS: ---
10 #        NOTES: ---
11 #       AUTHOR: Chris Cormack (rangi), chrisc@catalyst.net.nz
12 # ORGANIZATION: Koha Development Team
13 #      VERSION: 1.0
14 #      CREATED: 18/09/13 09:59:01
15 #     REVISION: ---
16 #===============================================================================
17
18 use strict;
19 use warnings;
20 use File::Slurp;
21
22 use Test::More tests => 7;    # last test to print
23
24 use lib 'lib';
25
26 use_ok('NCIP');
27 ok( my $ncip = NCIP->new('t/config_sample'), 'Create new object' );
28
29 my $xmlbad = <<'EOT';
30 <xml>
31 this is bad
32 <xml>
33 </xml>
34 EOT
35
36 # handle_initiation is called as part of the process_request, but best to test
37 # anyway
38 ok( !$ncip->handle_initiation($xmlbad), 'Bad xml' );
39
40 my $lookupitem = read_file('t/sample_data/LookupItem.xml');
41
42 ok( my $response = $ncip->process_request($lookupitem),
43     'Try looking up an item' );
44 is( $response, 'LookupItem', 'We got lookupitem' );
45
46 $lookupitem =
47   read_file('t/sample_data/LookupItemWithExampleItemIdentifierType.xml');
48 ok(
49     $response = $ncip->process_request($lookupitem),
50     'Try looking up an item, with agency'
51 );
52 is( $response, 'LookupItem', 'We got lookupitem with agency' );