3 use strict; use warnings;
4 use Test::More tests => 6;
6 use OpenILS::Utils::TestUtils;
7 use OpenILS::Utils::CStoreEditor qw/:funcs/;
8 use Apache2::Const -compile => qw(OK);
11 use_ok('OpenILS::WWW::EGCatLoader');
12 can_ok( 'OpenILS::WWW::EGCatLoader', 'load_print_or_email_preview' );
13 can_ok( 'OpenILS::WWW::EGCatLoader', 'load_email_record' );
15 use constant ATEV_ID => '123456789';
16 use constant PATRON_USERNAME => '99999359616';
17 use constant PATRON_PASSWORD => 'andreac1234';
19 my $script = OpenILS::Utils::TestUtils->new();
21 $script->authenticate({
22 username => PATRON_USERNAME,
23 password => PATRON_PASSWORD,
26 ok($script->authtoken, 'Have an authtoken');
27 my $authtoken = $script->authtoken;
29 my $loader_mock = Test::MockModule->new('OpenILS::WWW::EGCatLoader');
33 $cgi->param('context_org', 1);
34 $cgi->param('redirect_to', '/');
38 my $email_mock = Test::MockModule->new('Email::Send');
44 'authtoken' => $authtoken,
47 my $ou = Fieldmapper::actor::org_unit->new;
52 my $loader = new OpenILS::WWW::EGCatLoader(1, $ctx);
54 my $preview_response = $loader->load_print_or_email_preview('email');
55 is $preview_response, Apache2::Const::OK, 'Email preview delivers a good response';
57 my $event_id = $loader->ctx->{preview_record}->id();
59 unshift @{$loader->ctx->{page_args}}, $event_id;
61 my $response = $loader->load_email_record();
62 is $response, Apache2::Const::OK, 'Email record from OPAC delivers a good response';