X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fcustomfields%2Faccess_via_queue.t;h=a059d69ee5a29d4b5281d80ac452d1848ed68d7e;hb=86d3bab91d8baadcbe33e5bbceeb607990efa1eb;hp=c291860eaf1a1dd21a056fece84e127b1d1d7e2e;hpb=63a268637b2d51a8766412617724b9436439deb6;p=freeside.git diff --git a/rt/t/customfields/access_via_queue.t b/rt/t/customfields/access_via_queue.t index c291860ea..a059d69ee 100644 --- a/rt/t/customfields/access_via_queue.t +++ b/rt/t/customfields/access_via_queue.t @@ -1,9 +1,8 @@ -#!/usr/bin/perl -w use strict; use warnings; -use RT::Test tests => 35; +use RT::Test nodata => 1, tests => 47; use RT::Ticket; use RT::CustomField; @@ -11,11 +10,11 @@ my $queue_name = "CFSortQueue-$$"; my $queue = RT::Test->load_or_create_queue( Name => $queue_name ); ok($queue && $queue->id, "$queue_name - test queue creation"); -diag "create a CF\n" if $ENV{TEST_VERBOSE}; +diag "create a CF"; my $cf_name = "Rights$$"; my $cf; { - $cf = RT::CustomField->new( $RT::SystemUser ); + $cf = RT::CustomField->new( RT->SystemUser ); my ($ret, $msg) = $cf->Create( Name => $cf_name, Queue => $queue->id, @@ -98,7 +97,7 @@ ok( RT::Test->set_rights( my ($baseurl, $m) = RT::Test->started_ok; ok $m->login( tester => 'password' ), 'logged in'; -diag "check that we have no the CF on the create" if $ENV{'TEST_VERBOSE'}; +diag "check that we don't have the cf on create"; { $m->submit_form( form_name => "CreateTicketInQueue", @@ -115,46 +114,73 @@ diag "check that we have no the CF on the create" if $ENV{'TEST_VERBOSE'}; ); my ($tid) = ($m->content =~ /Ticket (\d+) created/i); ok $tid, "created a ticket succesfully"; - $m->content_unlike(qr/$cf_name/, "don't see CF"); + $m->content_lacks($cf_name, "don't see CF"); - $m->follow_link( text => 'Custom Fields' ); - $form = $m->form_number(3); + $m->follow_link( id => 'page-basics'); + $form = $m->form_name('TicketModify'); $cf_field = "Object-RT::Ticket-$tid-CustomField-". $cf->id ."-Value"; ok !$form->find_input( $cf_field ), 'no form field on the page'; } -diag "check that we see CF as Cc" if $ENV{'TEST_VERBOSE'}; +diag "check that we see CF as Cc"; { my $ticket = RT::Ticket->new( $tester ); my ($tid, $msg) = $ticket->Create( Queue => $queue, Subject => 'test', Cc => $tester->id ); ok $tid, "created ticket"; ok $m->goto_ticket( $tid ), "opened ticket"; - $m->content_like(qr/$cf_name/, "see CF"); + $m->content_contains($cf_name, "see CF"); } -diag "check that owner can see and edit CF" if $ENV{'TEST_VERBOSE'}; +diag "check that owner can see and edit CF"; { my $ticket = RT::Ticket->new( $tester ); my ($tid, $msg) = $ticket->Create( Queue => $queue, Subject => 'test', Cc => $tester->id, Owner => $tester->id ); ok $tid, "created ticket"; ok $m->goto_ticket( $tid ), "opened ticket"; - $m->content_like(qr/$cf_name/, "see CF"); + $m->content_contains($cf_name, "see CF"); - $m->follow_link( text => 'Custom Fields' ); - my $form = $m->form_number(3); + $m->follow_link( id => 'page-basics'); + my $form = $m->form_name('TicketModify'); my $cf_field = "Object-RT::Ticket-$tid-CustomField-". $cf->id ."-Value"; ok $form->find_input( $cf_field ), 'form field on the page'; $m->submit_form( - form_number => 3, + form_name => 'TicketModify', fields => { $cf_field => "changed cf", }, ); ok $m->goto_ticket( $tid ), "opened ticket"; - $m->content_like(qr/$cf_name/, "changed cf"); + $m->content_contains($cf_name, "changed cf"); +} + +note 'make sure CF is not reset to no value'; +{ + my $t = RT::Test->create_ticket( + Queue => $queue->id, + Subject => 'test', + 'CustomField-'.$cf->id => '2012-02-12', + Cc => $tester->id, + Owner => $tester->id, + ); + ok $t && $t->id, 'created ticket'; + is $t->FirstCustomFieldValue($cf_name), '2012-02-12'; + + $m->goto_ticket($t->id); + $m->follow_link_ok({id => 'page-basics'}); + my $form = $m->form_name('TicketModify'); + my $input = $form->find_input( + 'Object-RT::Ticket-'. $t->id .'-CustomField-'. $cf->id .'-Value' + ); + ok $input, 'found input'; + $m->click('SubmitTicket'); + + my $tid = $t->id; + $t = RT::Ticket->new( $RT::SystemUser ); + $t->Load( $tid ); + is $t->FirstCustomFieldValue($cf_name), '2012-02-12'; }