4 use RT::Test tests => 25;
6 my ($baseurl, $m) = RT::Test->started_ok;
8 RT::Test->create_tickets(
12 { Subject => 'tres' },
15 ok($m->login, 'logged in');
17 sorted_tickets_ok('Subject', ['2: dos', '3: tres', '1: uno']);
18 sorted_tickets_ok('+Subject', ['2: dos', '3: tres', '1: uno']);
19 sorted_tickets_ok('-Subject', ['1: uno', '3: tres', '2: dos']);
21 sorted_tickets_ok('id', ['1: uno', '2: dos', '3: tres']);
22 sorted_tickets_ok('+id', ['1: uno', '2: dos', '3: tres']);
23 sorted_tickets_ok('-id', ['3: tres', '2: dos', '1: uno']);
27 sub sorted_tickets_ok {
28 local $Test::Builder::Level = $Test::Builder::Level + 1;
34 my $uri = URI->new("$baseurl/REST/1.0/search/ticket");
41 my @lines = split /\n/, $m->content;
42 shift @lines; # header
43 shift @lines; # empty line
45 is_deeply(\@lines, $expected, "sorted results by '$order'");