fix ticketing system error on bootstrap of new install
[freeside.git] / rt / t / web / ticket_modify_all.t
1 use strict;
2 use warnings;
3
4 use RT::Test tests => undef;
5
6 my $ticket = RT::Test->create_ticket(
7     Subject => 'test bulk update',
8     Queue   => 1,
9 );
10
11 RT->Config->Set(AutocompleteOwners => 1);
12
13 my ( $url, $m ) = RT::Test->started_ok;
14 ok( $m->login, 'logged in' );
15
16 $m->get_ok( $url . "/Ticket/ModifyAll.html?id=" . $ticket->id );
17
18 $m->submit_form(
19     form_number => 3,
20     fields      => { 'UpdateContent' => 'this is update content' },
21     button      => 'SubmitTicket',
22 );
23
24 $m->content_contains("Comments added", 'updated ticket');
25 $m->content_lacks("this is update content", 'textarea is clear');
26
27 $m->get_ok($url . '/Ticket/Display.html?id=' . $ticket->id );
28 $m->content_contains("this is update content", 'updated content in display page');
29
30 $m->get_ok($url . '/Ticket/ModifyAll.html?id=' . $ticket->id);
31
32 $m->form_name('TicketModifyAll');
33 $m->field(Owner => 'root');
34 $m->click('SubmitTicket');
35
36 $m->form_name('TicketModifyAll');
37 is($m->value('Owner'), 'root', 'owner was successfully changed to root');
38
39 $m->get_ok($url . "/Ticket/ModifyAll.html?id=" . $ticket->id);
40
41 $m->form_name('TicketModifyAll');
42 $m->field('Starts_Date' => "2013-01-01 00:00:00");
43 $m->click('SubmitTicket');
44 $m->text_contains("Starts: (Tue Jan 01 00:00:00 2013)", 'start date successfully updated');
45
46 $m->form_name('TicketModifyAll');
47 $m->field('Started_Date' => "2014-01-01 00:00:00");
48 $m->click('SubmitTicket');
49 $m->text_contains("Started: (Wed Jan 01 00:00:00 2014)", 'started date successfully updated');
50
51 $m->form_name('TicketModifyAll');
52 $m->field('Told_Date' => "2015-01-01 00:00:00");
53 $m->click('SubmitTicket');
54 $m->text_contains("Last Contact:  (Thu Jan 01 00:00:00 2015)", 'told date successfully updated');
55
56 for my $unset ("0", "-", " ") {
57     $m->form_name('TicketModifyAll');
58     $m->field('Due_Date' => "2016-01-01 00:00:00");
59     $m->click('SubmitTicket');
60     $m->text_contains("Due: (Fri Jan 01 00:00:00 2016)", 'due date successfully updated');
61
62     $m->form_name('TicketModifyAll');
63     $m->field('Due_Date' => $unset);
64     $m->click('SubmitTicket');
65     $m->text_contains("Due: (Not set)", "due date successfully cleared with '$unset'");
66     $m->warning_like(qr/Couldn't parse date '-'/) if $unset eq "-";
67 }
68
69 $m->get( $url . '/Ticket/ModifyAll.html?id=' . $ticket->id );
70 $m->form_name('TicketModifyAll');
71 $m->field(WatcherTypeEmail => 'Requestor');
72 $m->field(WatcherAddressEmail => 'root@localhost');
73 $m->click('SubmitTicket');
74 $m->text_contains(
75     "Added root as a Requestor for this ticket",
76     'watcher is added',
77 );
78 $m->form_name('TicketModifyAll');
79 $m->field(WatcherTypeEmail => 'Requestor');
80 $m->field(WatcherAddressEmail => 'root@localhost');
81 $m->click('SubmitTicket');
82 $m->text_contains(
83     "root is already a Requestor",
84     'no duplicate watchers',
85 );
86
87 undef $m;
88 done_testing;