File: admin_queue_default_values.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 (65 lines) | stat: -rw-r--r-- 2,339 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
use strict;
use warnings;

use RT::Test tests => undef;

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

my $cf = RT::Test->load_or_create_custom_field(
    Name       => 'Notes',
    LookupType => RT::Ticket->CustomFieldLookupType,
    Type       => 'FreeformSingle',
    Queue      => 0,
);
my $txn_cf = RT::Test->load_or_create_custom_field(
    Name       => 'Actor',
    LookupType => RT::Transaction->CustomFieldLookupType,
    Type       => 'FreeformSingle',
    ObjectId   => 0,
);
my ( $ret, $msg ) = $txn_cf->AddToObject( RT::Queue->new( RT->SystemUser ) );
ok( $ret, 'Added txn cf Actor globally' );

my %default_values = (
    InitialPriority                                                       => 50,
    FinalPriority                                                         => 100,
    Starts                                                                => '2022-02-01 12:00:00',
    Due                                                                   => '2022-02-14 12:00:00',
    RT::Interface::Web::GetCustomFieldInputName( CustomField => $cf )     => 'default notes',
    RT::Interface::Web::GetCustomFieldInputName( CustomField => $txn_cf ) => 'default actor',
);

$m->get_ok( $url . '/Admin/Queues/DefaultValues.html?id=1' );
$m->submit_form_ok(
    {
        form_name => 'ModifyDefaultValues',
        fields    => \%default_values,
        button    => 'Update',
    }
);

for my $msg (
    'Default value of InitialPriority changed from (no value) to Medium',
    'Default value of FinalPriority changed from (no value) to High',
    'Default value of Starts changed from (no value) to 2022-02-01 12:00:00',
    'Default value of Due changed from (no value) to 2022-02-14 12:00:00',
    'Default values changed from (no value) to default notes',
    'Default values changed from (no value) to default actor',
    )
{
    $m->text_contains($msg);
}

my $form = $m->form_name('ModifyDefaultValues');
for my $field ( sort keys %default_values ) {
    is( $form->find_input($field)->value, $default_values{$field}, "$field value on default values page" );
}

$m->goto_create_ticket(1);
$form = $m->form_name('TicketCreate');
for my $field ( sort keys %default_values ) {
    is( $form->find_input($field)->value, $default_values{$field}, "$field value on create page" );
}

done_testing;