summaryrefslogtreecommitdiff
path: root/rt/t/web/cf_image.t
blob: 355f2596876ac024ce7726118eb184cf831451db (plain)
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
use strict;
use warnings;

use RT::Test tests => 'no_declare';

my (undef, $m) = RT::Test->started_ok;
$m->login;
$m->follow_link( id => 'admin-custom-fields-create' );
$m->submit_form_ok({
    form_name => "ModifyCustomField",
    fields    => {
        Name          => 'Images',
        TypeComposite => 'Image-1',
        LookupType    => 'RT::Queue-RT::Ticket',
    },
});
$m->content_contains("Object created");
my $cfid = $m->form_name('ModifyCustomField')->value('id');
ok $cfid, "Created CF correctly";

$m->follow_link_ok( {id => "page-applies-to"} );
$m->form_with_fields( "AddCustomField-1" );
$m->tick( "AddCustomField-1", 0 );
$m->click_ok( "UpdateObjs" );
$m->content_contains("Object created");


$m->submit_form_ok({
    form_name => "CreateTicketInQueue",
    fields    => { Queue => 'General' },
});
$m->content_contains("Upload one image");
$m->submit_form_ok({
    form_name => "TicketCreate",
    fields    => {
        Subject => 'Test ticket',
        Content => 'test',
    },
});
$m->content_like( qr/Ticket \d+ created/,
                  "a ticket is created succesfully" );

$m->follow_link_ok( {id => "page-basics"} );
$m->content_contains("Upload one image");
$m->submit_form_ok({
    form_name => "TicketModify",
    fields    => {
        "Object-RT::Ticket-1-CustomField-1-Upload" =>
            RT::Test::get_relocatable_file('bpslogo.png', '..', 'data'),
    },
});
$m->content_contains("bpslogo.png added");
$m->content_contains("/Download/CustomFieldValue/1/bpslogo.png");

$m->form_name("TicketModify");
$m->tick("Object-RT::Ticket-1-CustomField-1-DeleteValueIds", 1);
$m->click_ok("SubmitTicket");
$m->content_lacks("/Download/CustomFieldValue/1/bpslogo.png");

undef $m;
done_testing;