import rt 3.8.7
[freeside.git] / rt / t / web / command_line_with_unknown_field.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use File::Spec ();
5 use Test::Expect;
6 use RT::Test tests => 10;
7 my ($baseurl, $m) = RT::Test->started_ok;
8 my $rt_tool_path = "$RT::BinPath/rt";
9
10 $ENV{'RTUSER'} = 'root';
11 $ENV{'RTPASSWD'} = 'password';
12 $RT::Logger->debug("Connecting to server at ".RT->Config->Get('WebBaseURL'));
13 $ENV{'RTSERVER'} =RT->Config->Get('WebBaseURL') ;
14 $ENV{'RTDEBUG'} = '1';
15
16 expect_run(
17     command => "$rt_tool_path shell",
18     prompt => 'rt> ',
19     quit => 'quit',
20 );
21 expect_send(q{create -t ticket set subject='new ticket' add cc=foo@example.com}, "Creating a ticket...");
22 expect_like(qr/Ticket \d+ created/, "Created the ticket");
23 expect_handle->before() =~ /Ticket (\d+) created/;
24 my $ticket_id = $1;
25
26 expect_send("edit ticket/$ticket_id set marge=simpson", 'set unknown field');
27 expect_like(qr/marge: Unknown field/, 'marge is unknown field');
28 expect_like(qr/marge: simpson/, 'the value we set for marge is shown too');
29
30 expect_send("edit ticket/$ticket_id set homer=simpson", 'set unknown field');
31 expect_like(qr/homer: Unknown field/, 'homer is unknown field');
32 expect_like(qr/homer: simpson/, 'the value we set for homer is shown too');
33
34 expect_quit();