File: txn_content.t

package info (click to toggle)
request-tracker4 4.4.7%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 62,888 kB
  • sloc: javascript: 130,444; perl: 65,442; sh: 1,350; makefile: 480; python: 37; php: 30
file content (23 lines) | stat: -rw-r--r-- 863 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use warnings;
use strict;

use RT::Test tests => 4;
use MIME::Entity;
my $ticket = RT::Ticket->new(RT->SystemUser);
my $mime   = MIME::Entity->build(
    From => 'test@example.com',
    Type => 'text/html',
    Data => ["this is body\n"],
);
$mime->attach( Data => ['this is attachment'] );
my $id = $ticket->Create( MIMEObj => $mime, Queue => 'General' );
ok( $id, "created ticket $id" );
my $txns = $ticket->Transactions;
$txns->Limit( FIELD => 'Type', VALUE => 'Create' );
my $txn = $txns->First;
ok( $txn, 'got Create txn' );

# ->Content converts from text/html to plain text if we don't explicitly ask
# for html. Our html -> text converter seems to add an extra trailing newline
like( $txn->Content, qr/^\s*this is body\s*$/, "txn's html content converted to plain text" );
is( $txn->Content(Type => 'text/html'), "this is body\n", "txn's html content" );