File: scrip_execmodule.t

package info (click to toggle)
request-tracker4 4.4.1-3%2Bdeb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,208 kB
  • ctags: 5,607
  • sloc: perl: 60,294; sh: 1,086; makefile: 462; php: 15
file content (44 lines) | stat: -rw-r--r-- 1,233 bytes parent folder | download | duplicates (8)
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
use strict;
use warnings;
use RT::Test plugins => [qw(RT::Extension::ScripExecModule)];

my $system_user = RT->SystemUser;

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

{
    my $action = RT::ScripAction->new($system_user);
    my ( $val, $msg) = $action->Create(
        Name => 'TestExecModuleAction',
        Description => '',
        ExecModule => 'Foo::Bar',
    );
    ok($val, $msg);

    my $condition = RT::ScripCondition->new($system_user);
    ( $val, $msg ) = $condition->Create(
        Name => 'TestExecModuleCondition',
        Description => '',
        ApplicableTransTypes => 'Create',
        ExecModule => 'Foo::Bar',
    );
    ok($val, $msg);
 
    my $scrip = RT::Scrip->new($system_user);
    ($val, $msg) = $scrip->Create(
        Queue => $queue->Id,
        ScripAction => 'TestExecModuleAction',
        ScripCondition => 'TestExecModuleCondition',
        Template => 'Blank'
    );
    ok($val,$msg);

    my $ticket = RT::Ticket->new($system_user);
    my ( $tid, $trans_id, $tmsg ) = $ticket->Create(
        Subject => 'Sample workflow test',
        Owner => 'root',
        Queue => $queue->Id
    );
    ok($tid, $tmsg);
}