5 use RT::Test tests => 21, actual_server => 1;
6 my ($baseurl, $m) = RT::Test->started_ok;
7 my $rt_tool_path = "$RT::BinPath/rt";
9 $ENV{'RTUSER'} = 'root';
10 $ENV{'RTPASSWD'} = 'password';
11 $RT::Logger->debug("Connecting to server at ".RT->Config->Get('WebBaseURL'));
12 $ENV{'RTSERVER'} =RT->Config->Get('WebBaseURL') ;
13 $ENV{'RTDEBUG'} = '1';
14 $ENV{'RTCONFIG'} = '/dev/null';
17 command => "$rt_tool_path shell",
22 expect_send( q{create -t ticket set foo=bar}, "create ticket with unknown field" );
23 expect_like(qr/foo: Unknown field/, 'foo is unknown field');
24 expect_like(qr/Could not create ticket/, 'ticket is not created');
26 expect_send(q{create -t ticket set subject='new ticket' add cc=foo@example.com}, "Creating a ticket...");
28 expect_like(qr/Ticket \d+ created/, "Created the ticket");
29 expect_handle->before() =~ /Ticket (\d+) created/;
32 expect_send("edit ticket/$ticket_id set marge=simpson", 'set unknown field');
33 expect_like(qr/marge: Unknown field/, 'marge is unknown field');
34 expect_like(qr/marge: simpson/, 'the value we set for marge is shown too');
36 expect_send("edit ticket/$ticket_id set homer=simpson", 'set unknown field');
37 expect_like(qr/homer: Unknown field/, 'homer is unknown field');
38 expect_like(qr/homer: simpson/, 'the value we set for homer is shown too');
41 q{create -t ticket set requestors='foo@example.com, bar@example.com'},
42 "create ticket with field 'requestors'" );
43 expect_like(qr/Ticket \d+ created/, "Created the ticket");
44 expect_handle->before() =~ /Ticket (\d+) created/;
46 expect_send("show ticket/$ticket_id", 'check requestors');
47 expect_like(qr/From: (?:foo\@example\.com, bar\@example\.com|bar\@example\.com, foo\@example\.com)/, "requestors are set correctly");
51 # you may encounter warning like Use of uninitialized value $ampm
52 # ... in Time::ParseDate
53 my @warnings = grep { $_ !~ /\$ampm/ } $m->get_warnings;
54 is( scalar @warnings, 0, 'no extra warnings' );
56 1; # needed to avoid a weird exit value from expect_quit