X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fapproval%2Fadmincc.t;h=da8cac23da8f5bc77aaec348b6f1056f52dadec9;hb=3888fd6d1902f93c19d62df186e04617357f58c5;hp=7915b6a783fe3bebfca91885fd922938ae024212;hpb=fc6209f398899f0211cfcedeb81a3cd65e04a941;p=freeside.git diff --git a/rt/t/approval/admincc.t b/rt/t/approval/admincc.t index 7915b6a78..da8cac23d 100644 --- a/rt/t/approval/admincc.t +++ b/rt/t/approval/admincc.t @@ -2,17 +2,12 @@ use strict; use warnings; use Test::More; -BEGIN { - eval { require Email::Abstract; require Test::Email; 1 } - or plan skip_all => 'require Email::Abstract and Test::Email'; -} - use RT; -use RT::Test tests => 58; +use RT::Test tests => "no_declare"; use RT::Test::Email; -RT->Config->Set( LogToScreen => 'debug' ); +RT->Config->Set( LogToSTDERR => 'debug' ); RT->Config->Set( UseTransactionBatch => 1 ); my ($baseurl, $m) = RT::Test->started_ok; @@ -42,7 +37,6 @@ Queue: ___Approvals Type: approval Owner: CTO AdminCCs: COO, CEO -Requestors: {$Tickets{"TOP"}->Requestors} DependedOnBy: TOP Subject: CTO Approval for PO: {$Tickets{"TOP"}->Id} - {$Tickets{"TOP"}->Subject} Due: {time + 86400} @@ -84,20 +78,20 @@ mail_ok { Requestor => 'minion', Queue => $q->Id, ); -} { from => qr/RT System/, - bcc => qr/ceo.*coo|coo.*ceo/i, - subject => qr/PO for stationary/i, -}, -{ from => qr/RT System/, - to => 'cto@company.com', - subject => qr/New Pending Approval: CTO Approval/, - body => qr/pending your approval.*Your approval is requested.*Blah/s -}, -{ from => qr/PO via RT/, +} { from => qr/PO via RT/, to => 'minion@company.com', subject => qr/PO for stationary/, body => qr/automatically generated in response/ -}; +},{ from => qr/RT System/, + to => 'root@localhost', + subject => qr/PO for stationary/, +},{ from => qr/RT System/, + to => 'cto@company.com', + bcc => qr/ceo.*coo|coo.*ceo/i, + subject => qr/New Pending Approval: CTO Approval/, + body => qr/pending your approval.*Your approval is requested.*Blah/s +} +; ok ($tid,$tmsg); @@ -134,6 +128,11 @@ mail_ok { }, { from => qr/RT System/, + to => 'root@localhost', + subject => qr/Ticket Approved:/, +}, +{ + from => qr/RT System/, to => 'minion@company.com', subject => qr/Ticket Approved:/, body => qr/approved by CTO.*notes: Resources exist to be consumed/s @@ -180,6 +179,12 @@ for my $admin (qw/coo ceo/) { body => qr/Resources exist to be consumed/, }, { + from => qr/RT System/, + to => 'root@localhost', + subject => qr/Ticket Approved:/, + body => qr/approved by \U$admin\E.*notes: Resources exist to be consumed/s + }, + { from => qr/RT System/, to => 'minion@company.com', subject => qr/Ticket Approved:/, @@ -236,14 +241,18 @@ $m->get_ok( $approval_link ); $m_coo->get_ok( $approval_link ); $m_ceo->get_ok( $approval_link ); -$m->content_like( qr/first approval.*second approval/s, 'cto: see both approvals' ); -$m_coo->content_like( qr/first approval.*second approval/s, 'coo: see both approvals' ); -$m_ceo->content_like( qr/first approval.*second approval/s, 'ceo: see both approvals' ); +$m->content_contains('first approval', 'cto: see both approvals' ); +$m->content_contains('second approval', 'cto: see both approvals' ); + +$m_coo->content_contains('first approval', 'coo: see both approvals'); +$m_coo->content_contains('second approval', 'coo: see both approvals'); + +$m_ceo->content_contains('first approval', 'ceo: see both approvals'); +$m_ceo->content_contains('second approval', 'ceo: see both approvals'); # now let's approve the first one via cto -$m->content_like( qr/first approval.*second approval/s, 'cto can see both approvals' ); $m->submit_form( - form_number => 3, + form_name => 'Approvals', fields => { 'Approval-' . $first_approval->id . '-Action' => 'approve', }, ); @@ -257,7 +266,7 @@ $m_ceo->content_lacks( 'first approval', 'ceo: first approval is gone' ); $m_ceo->content_contains( 'second approval', 'ceo: second approval is still here' ); $m_coo->submit_form( - form_number => 3, + form_name => 'Approvals', fields => { 'Approval-' . $second_approval->id . '-Action' => 'approve', }, ); @@ -269,3 +278,6 @@ $m_coo->content_lacks( 'second approval', 'coo: second approval is gone too' ); $m_ceo->content_lacks( 'second approval', 'ceo: second approval is gone too' ); RT::Test->clean_caught_mails; + +undef $m; +done_testing;