6 use RT::Test tests => 20;
8 my $plain = MIME::Entity->build(
9 Subject => 'plain mime',
12 If you have some problems with RT you could find help
13 on http://wiki.bestpractical.com or subscribe to
14 the rt-users\@lists.bestpractical.com.
17 https://wiki.bestpractical.com/test#anchor
19 Best regards. BestPractical Team.
23 my $html = MIME::Entity->build(
25 Subject => 'html mime',
27 If you have some problems with RT you could find help
28 on <a href="http://wiki.bestpractical.com">wiki</a>
29 or find known bugs on http://rt3.fsck.com
32 https://wiki.bestpractical.com/test#anchor
34 Best regards. BestPractical Team.
39 my $ticket = RT::Ticket->new( RT->SystemUser );
41 my ($plain_id) = $ticket->Create(
46 ok($plain_id, "We created a ticket #$plain_id");
48 my ($html_id) = $ticket->Create(
53 ok($html_id, "We created a ticket #$html_id");
55 diag 'test no clicky';
57 RT->Config->Set( 'Active_MakeClicky' => () );
58 my ( $baseurl, $m ) = RT::Test->started_ok;
59 ok $m->login, 'logged in';
60 $m->goto_ticket($plain_id);
62 my @links = $m->find_link(
64 url => 'http://wiki.bestpractical.com',
66 ok( @links == 0, 'no clicky link found with plain message' );
68 @links = $m->find_link(
70 url => 'http://rt3.fsck.com',
72 ok( @links == 0, 'no extra clicky link found with html message' );
77 RT::Test->stop_server;
78 RT->Config->Set( 'Active_MakeClicky' => qw/httpurl/ );
79 my ( $baseurl, $m ) = RT::Test->started_ok;
80 ok $m->login, 'logged in';
81 $m->goto_ticket($plain_id);
83 my @links = $m->find_link(
85 url => 'http://wiki.bestpractical.com',
88 ok( scalar @links, 'found clicky link' );
90 @links = $m->find_link(
92 url => 'https://wiki.bestpractical.com/test#anchor',
95 ok( scalar @links, 'found clicky link with anchor' );
97 $m->goto_ticket($html_id);
98 @links = $m->find_link(
100 url => 'http://wiki.bestpractical.com',
103 ok( @links == 0, 'not make clicky links clicky twice' );
105 @links = $m->find_link(
107 url => 'http://rt3.fsck.com',
110 ok( scalar @links, 'found clicky link' );
112 @links = $m->find_link(
114 url => 'https://wiki.bestpractical.com/test#anchor',
117 ok( scalar @links, 'found clicky link with anchor' );
120 diag 'test httpurl_overwrite';
122 RT::Test->stop_server;
123 RT->Config->Set( 'Active_MakeClicky' => 'httpurl_overwrite' );
124 my ( $baseurl, $m ) = RT::Test->started_ok;
125 ok $m->login, 'logged in';
126 ok $m->goto_ticket($plain_id), 'opened diplay page of the ticket';
128 my @links = $m->find_link(
130 url => 'http://wiki.bestpractical.com',
131 text => 'http://wiki.bestpractical.com',
133 ok( scalar @links, 'found clicky link' );
135 @links = $m->find_link(
137 url => 'https://wiki.bestpractical.com/test#anchor',
138 text => 'https://wiki.bestpractical.com/test#anchor',
140 ok( scalar @links, 'found clicky link with anchor' );