4 use RT::Test tests => undef;
6 RT->Config->Set( MailCommand => 'sendmailpipe' );
7 RT->Config->Set( VERPPrefix => "verp-" );
8 RT->Config->Set( VERPDomain => "example.com" );
10 # Ensure that the fake sendmail knows where to write to
11 $ENV{RT_MAILLOGFILE} = RT::Test->temp_directory . "/sendmailpipe.log";
12 my $fake = File::Spec->rel2abs( File::Spec->catfile(
13 't', 'security', 'fake-sendmail' ) );
14 RT->Config->Set( SendmailPath => $fake);
18 { Principal => 'Everyone', Right => [qw/CreateTicket/] },
23 my $bad = RT::Test->load_or_create_user(
24 EmailAddress => 'danger-$USER@example.com',
26 ok( $bad, "Got a user object back" );
27 ok( $bad->id, "Successfully created a user" );
29 my $current_user = RT::CurrentUser->new(RT->SystemUser);
30 my ($id, $msg) = $current_user->Load($bad->Id);
31 ok( $id, "Loaded the user successfully" );
33 my $ticket = RT::Ticket->new( $current_user );
34 ($id, $msg) = $ticket->Create(
35 Requestor => $bad->Id,
36 Subject => "Danger, Will Robinson!",
39 ok( $id, "Created a ticket: $msg" );
41 open(LOG, "<", $ENV{RT_MAILLOGFILE}) or die "Can't open log file: $!";
42 while (my $line = <LOG>) {
43 next unless $line =~ /^-f/;
44 like($line, qr/\$USER/, "Contains uninterpolated \$USER");