File: ticket_txn_subject.t

package info (click to toggle)
request-tracker5 5.0.7%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 80,216 kB
  • sloc: javascript: 191,898; perl: 87,146; sh: 1,412; makefile: 487; python: 37; php: 15
file content (81 lines) | stat: -rw-r--r-- 2,709 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use strict;
use warnings;

use RT::Test tests => undef;

my ($base, $m) = RT::Test->started_ok;
ok $m->login, 'logged in';

my @tickets;

diag "create a ticket via the API";
{
    my $ticket = RT::Ticket->new( RT->SystemUser );
    my ($id, $txn, $msg) = $ticket->Create(
        Queue => 'General',
        Subject => Encode::decode("UTF-8",'bad subject‽'),
    );
    ok $id, 'created a ticket #'. $id or diag "error: $msg";
    is $ticket->Subject, Encode::decode("UTF-8",'bad subject‽'), 'correct subject';
    push @tickets, $id;
}

diag "create a ticket via the web";
{
    $m->get_ok('/Ticket/Create.html?Queue=1', 'open ticket create page');
    $m->submit_form_ok({
        with_fields => {
            Subject => Encode::decode("UTF-8",'bad subject #2‽'),
        },
        button => 'SubmitTicket'
    }, 'create ticket');
    $m->content_contains(Encode::decode("UTF-8",'bad subject #2‽'), 'correct subject');
    push @tickets, 2;
}

diag "create a ticket via the web without a unicode subject";
{
    $m->get_ok('/Ticket/Create.html?Queue=1', 'open ticket create page');
    $m->submit_form_ok({
        with_fields => {
            Subject => 'a fine subject #3',
        },
        button => 'SubmitTicket'
    }, 'create ticket');
    $m->content_contains('a fine subject #3', 'correct subject');
    push @tickets, 3;
}

for my $tid (@tickets) {
    diag "ticket #$tid";
    diag "add a reply which adds to the subject, but without an attachment";
    {
        $m->goto_ticket($tid);
        $m->follow_link_ok({ id => 'page-actions-reply' }, "Actions -> Reply");
        $m->submit_form_ok({
            with_fields => {
                UpdateSubject => Encode::decode("UTF-8",'bad subject‽ without attachment'),
                UpdateContent => 'testing unicode txn subjects',
            },
            button => 'SubmitTicket',
        }, 'submit reply');
        $m->content_contains(Encode::decode("UTF-8",'bad subject‽ without attachment'), "found txn subject");
    }

    diag "add a reply which adds to the subject with an attachment";
    {
        $m->goto_ticket($tid);
        $m->follow_link_ok({ id => 'page-actions-reply' }, "Actions -> Reply");
        $m->submit_form_ok({
            with_fields => {
                UpdateSubject => Encode::decode("UTF-8",'bad subject‽ with attachment'),
                UpdateContent => 'testing unicode txn subjects',
                Attach => RT::Test::get_relocatable_file('bpslogo.png', '..', 'data'),
            },
            button => 'SubmitTicket',
        }, 'submit reply');
        $m->content_contains(Encode::decode("UTF-8",'bad subject‽ with attachment'), "found txn subject");
    }
}

done_testing;