File: lifecycle_rights.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 (51 lines) | stat: -rw-r--r-- 1,426 bytes parent folder | download | duplicates (4)
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
use strict;
use warnings;

BEGIN {require './t/lifecycles/utils.pl'};

diag 'Test web UI for ticket status without SeeQueue right';
{
    my ( $url, $agent ) = RT::Test->started_ok;

    my $delivery = RT::Test->load_or_create_queue(
        Name => 'delivery',
        Lifecycle => 'delivery',
    );
    ok $delivery && $delivery->id, 'loaded or created a queue';

    my $ticket = RT::Test->create_ticket(Queue => 'Delivery');
    ok $ticket && $ticket->Id;

    my $user_a = RT::Test->load_or_create_user(
        Name => 'user_a', Password => 'password', Privileged => 1,
    );
    ok $user_a && $user_a->id, 'loaded or created user';

    RT::Test->set_rights(
        { Principal => 'Everyone',  Right => [qw(ModifyTicket ShowTicket)] },
    );

    ok( $agent->login( 'user_a' , 'password' ), 'logged in as user_a');

    $agent->get_ok($url . '/Ticket/Modify.html?id=' . $ticket->Id);
    $agent->form_name('TicketModify');

    my ($inputs) = $agent->find_all_inputs(
        type       => 'option',
        name       => 'Status',
    );

    $agent->get_ok($url . '/Ticket/Modify.html?id=' . $ticket->Id);
    $agent->form_name('TicketModify');

    # Refresh page after rights update
    ($inputs) = $agent->find_all_inputs(
        type       => 'option',
        name       => 'Status',
    );

    ok $inputs->value_names > 2, 'We are able to transition to other statuses with role rights';

}

done_testing;