start fixing test for multi cat phenotype upload.
[sgn.git] / t / unit_fixture / SGN / View / Email / ErrorEmail.t
bloba7aa3b1b989df54069b085e0a09e7c41a4b3bae9
1 use strict;
2 use warnings;
3 use Test::More;
4 use Test::MockObject;
6 use lib 't/lib';
7 BEGIN { $ENV{SGN_SKIP_CGI} = 1 }
8 use SGN::Test 'ctx_request';
9 use SGN::Test::WWW::Mechanize;
11 BEGIN { use_ok 'SGN::View::Email::ErrorEmail' }
13 my $mech = SGN::Test::WWW::Mechanize->new;
14 $mech->with_test_level( process => sub {
16     my ($res, $c) = ctx_request('/');
17     $c->stash->{email_errors} = [ SGN::Exception->new( message => 'Fake test error!') ];
18     $c->view('Email::ErrorEmail')->maximum_body_size( 50000 );
19     my $email = $c->view('Email::ErrorEmail')->make_email( $c );
21     is( $email->{subject}, '[SGN](E) /', 'got a good subject line' );
22     like( $email->{body}, qr/object skipped/, 'email body looks right' );
23     like( $email->{body}, qr/=== Request ===/, 'email body has a Request' );
24     like( $email->{body}, qr/=== Summary ===/, 'email body has a Summary' );
25     like( $email->{body}, qr/"<redacted>"/, 'redacted some stuff' );
26     like( $email->{body}, qr/email body truncated/, 'body was truncated' );
27 });
29 done_testing();