1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
use strict;
use warnings;
use Test::Expect;
use RT::Test tests => 12, actual_server => 1;
my $class = RT::Class->new( RT->SystemUser );
my ( $class_id, $msg ) = $class->Create( Name => 'foo' );
ok( $class_id, $msg );
my $article = RT::Article->new( RT->SystemUser );
( my $article_id, $msg ) =
$article->Create( Class => 'foo', Summary => 'article summary' );
ok( $article_id, $msg );
my ( $baseurl, $m ) = RT::Test->started_ok;
my $rt_tool_path = "$RT::BinPath/rt";
$ENV{'RTUSER'} = 'root';
$ENV{'RTPASSWD'} = 'password';
$RT::Logger->debug(
"Connecting to server at " . RT->Config->Get('WebBaseURL') );
$ENV{'RTSERVER'} = RT->Config->Get('WebBaseURL');
$ENV{'RTDEBUG'} = '1';
$ENV{'RTCONFIG'} = '/dev/null';
expect_run(
command => "$rt_tool_path shell",
prompt => 'rt> ',
quit => 'quit',
);
expect_send( q{create -t ticket set subject='new ticket'},
"creating a ticket..." );
expect_like( qr/Ticket \d+ created/, "created the ticket" );
expect_handle->before() =~ /Ticket (\d+) created/;
my $ticket_id = $1;
expect_send(
"link $ticket_id RefersTo a:$article_id",
"link $ticket_id RefersTo a:$article_id"
);
expect_like( qr/Created link $ticket_id RefersTo a:$article_id/,
'created link' );
expect_send( "show -s ticket/$ticket_id/links", "show ticket links" );
expect_like( qr|RefersTo: fsck\.com-article://example\.com/article/$article_id|,
"found new created link" );
expect_quit();
|