[Rt-commit] [rtir] 03/03: remove constituency propagation tests

Dustin Graves dustin at bestpractical.com
Fri May 13 19:11:34 EDT 2016


This is an automated email from the git hooks/post-receive script.

dustin pushed a commit to branch 3.4/rewrite-constituency-tests
in repository rtir.

commit a36dc209abc61943a07aeb145bb7110010abd131
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Fri May 13 23:10:22 2016 +0000

    remove constituency propagation tests
    
    this behavior is handled by the different queues available in the queue
    dropdown, which will be in a js modal and cannot be tested by the
    testing frameworks
---
 t/constituency/propagation-inherit.t | 279 -------------------------------
 t/constituency/propagation-no.t      | 193 ----------------------
 t/constituency/propagation-reject.t  | 310 -----------------------------------
 3 files changed, 782 deletions(-)

diff --git a/t/constituency/propagation-inherit.t b/t/constituency/propagation-inherit.t
deleted file mode 100644
index 6256b49..0000000
--- a/t/constituency/propagation-inherit.t
+++ /dev/null
@@ -1,279 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use Test::More skip_all => 'constituencies being rebuilt';
-
-use RT::IR::Test tests => undef;
-
-use_ok('RT::IR');
-RT->Config->Set('_RTIR_Constituency_Propagation' => 'inherit');
-
-my $cf;
-diag "load the field" if $ENV{'TEST_VERBOSE'};
-{
-    my $cfs = RT::CustomFields->new( $RT::SystemUser );
-    $cfs->Limit( FIELD => 'Name', VALUE => 'Constituency', CASESENSITIVE => 0 );
-    $cf = $cfs->First;
-    ok $cf, 'have a field';
-    ok $cf->id, 'with some ID';
-}
-
-RT::Test->started_ok;
-my $agent = default_agent();
-my $rtir_user = rtir_user();
-
-diag "create an IR with GOVNET constituency and create a new "
-    . "incident for the IR, we want it to inherit by default"
-        if $ENV{'TEST_VERBOSE'};
-{
-    my $ir_id = $agent->create_ir(
-         { Subject => "test" }, { Constituency => 'GOVNET' }
-    );
-    ok $ir_id, "created IR #$ir_id";
-    $agent->display_ticket( $ir_id);
-
-    my $inc_id = $agent->create_incident_for_ir(
-         $ir_id, { Subject => "test" },
-    );
-
-    my $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $inc_id );
-    ok $ticket->id, 'loaded ticket';
-    is uc $ticket->FirstCustomFieldValue('Constituency'),
-        'GOVNET', 'correct value';
-}
-
-diag "create an IR and check that we couldn't change constituency"
-    ." value during creation of new linked incident" if $ENV{'TEST_VERBOSE'};
-{
-    # create an IR
-    my $ir_id = $agent->create_ir(
-         { Subject => "test" }, { Constituency => 'GOVNET' }
-    );
-    ok $ir_id, "created ticket #$ir_id";
-    $agent->display_ticket( $ir_id);
-    $agent->content_like( qr/GOVNET/, "value on the page" );
-    my $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $ir_id );
-    ok $ticket->id, 'loaded ticket';
-    is $ticket->QueueObj->Name, 'Incident Reports', 'correct value';
-    is $ticket->FirstCustomFieldValue('Constituency'), 'GOVNET', 'correct value';
-
-    # click [new] near 'incident', set another constituency and create
-    $agent->follow_link_ok({text => 'New'}, "go to 'New Incident' page");
-    $agent->form_number(3);
-    my $form = $agent->form_number(3);
-    ok $form->find_input( $form->value('Constituency'), 'hidden'), 'constituency field is hidden';
-    $agent->click('CreateIncident');
-    is $agent->status, 200, "Attempted to create the ticket";
-
-    DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-    # Incident has the same value 
-    my $inc_id = $agent->get_ticket_id();
-    $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $inc_id );
-    ok $ticket->id, 'loaded ticket';
-    is $ticket->QueueObj->Name, 'Incidents', 'correct value';
-    is $ticket->FirstCustomFieldValue('Constituency'),
-        'GOVNET', 'correct value';
-
-    # And the report too
-    $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $ir_id );
-    ok $ticket->id, 'loaded ticket';
-    is $ticket->QueueObj->Name, 'Incident Reports', 'correct value';
-    is $ticket->FirstCustomFieldValue('Constituency'),
-        'GOVNET', 'correct value';
-}
-
-diag "create an incident with EDUNET, then create children using Incident input field."
-    . " incident's constituency is prefered even if another value's been selected"
-        if $ENV{'TEST_VERBOSE'};
-{
-    my $incident_id = $agent->create_rtir_ticket_ok(
-         'Incidents',
-        { Subject => "test" },
-        { Constituency => 'EDUNET' },
-    );
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $incident_id );
-        ok $ticket->id, 'loaded ticket';
-        is $ticket->FirstCustomFieldValue('Constituency'),
-            'EDUNET', 'correct value';
-    }
-
-    foreach my $queue( 'Incident Reports', 'Investigations', 'Blocks' ) {
-        diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
-
-        my $id = $agent->create_rtir_ticket_ok(
-             $queue,
-            {
-                Subject => "test constituency",
-                Incident => $incident_id,
-            },
-            { Constituency => 'GOVNET' },
-        );
-
-        $agent->display_ticket( $id);
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-        
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $id );
-            ok $ticket->id, 'loaded ticket';
-            is uc $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', 'value has been changed';
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', 'incident still has the same value';
-        }
-    }
-}
-
-diag "check that constituency propagates from a child to a parent after 'Edit', and back"
-    if $ENV{'TEST_VERBOSE'};
-{
-    foreach my $queue( 'Incident Reports', 'Investigations', 'Blocks' ) {
-        diag "create an incident for linking" if $ENV{'TEST_VERBOSE'};
-
-        my $incident_id = $agent->create_rtir_ticket_ok(
-             'Incidents', { Subject => "test" }, { Constituency => 'GOVNET' },
-        );
-        diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
-        my $child_id = $agent->create_rtir_ticket_ok(
-             $queue,
-            {
-                Subject => "test constituency",
-                Incident => $incident_id,
-            },
-            { Constituency => 'GOVNET' },
-        );
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-        diag "check that both have the same correct constituency" if $ENV{'TEST_VERBOSE'};
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'GOVNET', 'correct value';
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $child_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'GOVNET', 'correct value';
-        }
-        
-        diag "edit constituency on the child" if $ENV{'TEST_VERBOSE'};
-        $agent->display_ticket( $child_id);
-        $agent->follow_link( text => 'Edit' );
-        $agent->form_number(3);
-        $agent->select("Object-RT::Ticket-$child_id-CustomField-". $cf->id ."-Values" => 'EDUNET' );
-        $agent->click('SaveChanges');
-        $agent->content_like(qr/Constituency .* changed to EDUNET/mi, 'field is changed');
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-        diag "check that constituency propagates from the child to the parent" if $ENV{'TEST_VERBOSE'};
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $child_id );
-            ok $ticket->id, 'loaded ticket';
-            is uc $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', 'correct value';
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', "incident's constituency has been changed";
-        }
-
-        diag "edit constituency on the incident" if $ENV{'TEST_VERBOSE'};
-        $agent->display_ticket( $incident_id);
-        $agent->follow_link( text => 'Edit' );
-        $agent->form_number(3);
-        $agent->select("Object-RT::Ticket-$incident_id-CustomField-". $cf->id ."-Values" => 'GOVNET' );
-        $agent->click('SaveChanges');
-        $agent->content_like(qr/Constituency .* changed to GOVNET/mi, 'field is changed');
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-        diag "check that constituency propagatesi from the parent to the child" if $ENV{'TEST_VERBOSE'};
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $child_id );
-            ok $ticket->id, 'loaded ticket';
-            is uc $ticket->FirstCustomFieldValue('Constituency'),
-                'GOVNET', 'correct value';
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'GOVNET', "incident's constituency has been changed";
-        }
-    }
-}
-
-diag "check that constituency propagates from a child to a parent after 'Edit', and back"
-    if $ENV{'TEST_VERBOSE'};
-{
-    # can not test this for blocks as those require incident on create
-    foreach my $queue( 'Incident Reports', 'Investigations' ) {
-        diag "create an incident for linking" if $ENV{'TEST_VERBOSE'};
-
-        my $incident_id = $agent->create_rtir_ticket_ok(
-             'Incidents', { Subject => "test" }, { Constituency => 'EDUNET' },
-        );
-        diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
-        my $child_id = $agent->create_rtir_ticket_ok(
-             $queue,
-            { Subject => "test constituency" },
-            { Constituency => 'GOVNET' },
-        );
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-        diag "check that both have the same correct constituency" if $ENV{'TEST_VERBOSE'};
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', 'correct value';
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $child_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'GOVNET', 'correct value';
-        }
-        
-        diag "link the child to parent" if $ENV{'TEST_VERBOSE'};
-        $agent->LinkChildToIncident( $child_id, $incident_id );
-
-        diag "check that constituency propagates from parent to child on linking" if $ENV{'TEST_VERBOSE'};
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $child_id );
-            ok $ticket->id, 'loaded ticket';
-            is uc $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', "child's constituency has been changed";
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', 'correct value';
-        }
-    }
-}
-
-
-undef $agent;
-done_testing;
diff --git a/t/constituency/propagation-no.t b/t/constituency/propagation-no.t
deleted file mode 100644
index defba31..0000000
--- a/t/constituency/propagation-no.t
+++ /dev/null
@@ -1,193 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More skip_all => 'constituencies being rebuilt';
-use RT::IR::Test tests => undef;
-
-use_ok('RT::IR');
-RT->Config->Set('_RTIR_Constituency_Propagation' => 'no');
-
-my $cf;
-diag "load the field" if $ENV{'TEST_VERBOSE'};
-{
-    my $cfs = RT::CustomFields->new( $RT::SystemUser );
-    $cfs->Limit( FIELD => 'Name', VALUE => 'Constituency', CASESENSITIVE => 0 );
-    $cf = $cfs->First;
-    ok $cf, 'have a field';
-    ok $cf->id, 'with some ID';
-}
-
-RT::Test->started_ok;
-my $agent = default_agent();
-my $rtir_user = rtir_user();
-
-diag "create an incident with EDUNET and then linked tickets with GOVNET,"
-    . " constituency shouldn't propagate back to tickets"
-    if $ENV{'TEST_VERBOSE'};
-{
-    my $incident_id = $agent->create_rtir_ticket_ok(
-        'Incidents',
-        { Subject => "test" },
-        { Constituency => 'EDUNET' },
-    );
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $incident_id );
-        ok $ticket->id, 'loaded ticket';
-        is $ticket->FirstCustomFieldValue('Constituency'),
-            'EDUNET', 'correct value';
-    }
-
-    foreach my $queue( 'Incident Reports', 'Investigations', 'Blocks' ) {
-        diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
-
-        my $id = $agent->create_rtir_ticket_ok(
-            $queue,
-            {
-                Subject => "test ip",
-                Incident => $incident_id,
-            },
-            { Constituency => 'GOVNET' },
-        );
-
-        $agent->display_ticket( $id);
-        $agent->content_like( qr/GOVNET/i, "value on the page" );
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-        
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $id );
-            ok $ticket->id, 'loaded ticket';
-            is uc $ticket->FirstCustomFieldValue('Constituency'),
-                'GOVNET', 'correct value';
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', 'incident still has the same value';
-        }
-
-diag "check that if we edit value twice then incident's constituency is still the same"
-    if $ENV{'TEST_VERBOSE'};
-
-        $agent->follow_link( text => 'Edit' );
-        $agent->form_number(3);
-        $agent->select("Object-RT::Ticket-$id-CustomField-". $cf->id ."-Values" => 'EDUNET' ) or diag $agent->content;
-        $agent->click('SaveChanges');
-        $agent->content_like(qr/Constituency .* changed to EDUNET/mi, 'field is changed');
-
-        $agent->follow_link( text => 'Edit' );
-        $agent->form_number(3);
-        $agent->select("Object-RT::Ticket-$id-CustomField-". $cf->id ."-Values" => 'GOVNET' );
-        $agent->click('SaveChanges');
-        $agent->content_like(qr/Constituency .* changed to GOVNET/mi, 'field is changed');
-
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $id );
-            ok $ticket->id, 'loaded ticket';
-            is uc $ticket->FirstCustomFieldValue('Constituency'),
-                'GOVNET', 'correct value';
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->FirstCustomFieldValue('Constituency'),
-                'EDUNET', 'incident still has the same value';
-        }
-    }
-}
-
-diag "create an IR with GOVNET constituency and create a new "
-    . "incident for the IR, we want it to inherit"
-        if $ENV{'TEST_VERBOSE'};
-{
-    my $ir_id = $agent->create_ir(
-        { Subject => "test" }, { Constituency => 'GOVNET' }
-    );
-    ok $ir_id, "created IR #$ir_id";
-    $agent->display_ticket( $ir_id);
-
-    my $inc_id = $agent->create_incident_for_ir(
-        $ir_id, { Subject => "test" },
-    );
-
-    my $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $inc_id );
-    ok $ticket->id, 'loaded ticket';
-    is uc $ticket->FirstCustomFieldValue('Constituency'),
-        'GOVNET', 'correct value';
-}
-
-diag "inheritance should be soft, so user can change constituency using ui"
-        if $ENV{'TEST_VERBOSE'};
-{
-    my $ir_id = $agent->create_ir(
-        { Subject => "test" }, { Constituency => 'GOVNET' }
-    );
-    ok $ir_id, "created IR #$ir_id";
-    $agent->display_ticket( $ir_id);
-
-    my $inc_id = $agent->create_incident_for_ir(
-        $ir_id, { Subject => "test" }, { Constituency => 'EDUNET' }
-    );
-
-    my $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $inc_id );
-    ok $ticket->id, 'loaded ticket';
-    is uc $ticket->FirstCustomFieldValue('Constituency'),
-        'EDUNET', 'correct value';
-}
-
-diag "create an incident under GOVNET and create a new IR "
-    ."linked to the incident with different constituency"
-        if $ENV{'TEST_VERBOSE'};
-{
-    diag "first of all create the incident" if $ENV{'TEST_VERBOSE'};
-
-    my $inc_id = $agent->create_incident(
-        { Subject => "test" }, { Constituency => 'GOVNET' }
-    );
-    ok( $inc_id, "created ticket #$inc_id" );
-    $agent->display_ticket( $inc_id );
-    $agent->content_like( qr/GOVNET/, "value on the page" );
-    DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $inc_id );
-        ok $ticket->id, 'loaded ticket';
-        is uc $ticket->FirstCustomFieldValue('Constituency'),
-            'GOVNET', 'correct value';
-    }
-
-    diag "then create the report" if $ENV{'TEST_VERBOSE'};
-    my $ir_id = $agent->create_ir(
-        { Subject => "test", Incident => $inc_id }, { Constituency => 'EDUNET' },
-    );
-    $agent->ticket_is_linked_to_inc( $ir_id => $inc_id );
-    DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $ir_id );
-        ok $ticket->id, 'loaded ticket';
-        is uc $ticket->FirstCustomFieldValue('Constituency'),
-            'EDUNET', 'correct value';
-    } {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $inc_id );
-        ok $ticket->id, 'loaded ticket';
-        is uc $ticket->FirstCustomFieldValue('Constituency'),
-            'GOVNET', 'correct value';
-    }
-}
-
-
-undef $agent;
-done_testing;
diff --git a/t/constituency/propagation-reject.t b/t/constituency/propagation-reject.t
deleted file mode 100644
index d4605d7..0000000
--- a/t/constituency/propagation-reject.t
+++ /dev/null
@@ -1,310 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More skip_all => 'constituencies being rebuilt';
-use RT::IR::Test tests => undef;
-
-use_ok('RT::IR');
-RT->Config->Set('RTIR_StrictConstituencyLinking'=> 1);
-
-for my $constituency ('EDUNET','GOVNET') {
-    my $path = RT::Plugin->new( name => 'RT::IR' )->Path( 'bin' ) . "/add_constituency";
-    diag("running $path to set up EDUNET and GOVNET constituencies");
-
-        my ($exit_code, $output) = RT::Test->run_and_capture(
-                command     => $path,
-                name        => $constituency,
-                force       => 1,
-                quiet       => 1,
-            );
-         ok(!$exit_code, "created constituency $constituency");
-         diag "output: $output";
-
-}
-my $cf;
-diag "load the field" if $ENV{'TEST_VERBOSE'};
-{
-    my $cfs = RT::CustomFields->new( $RT::SystemUser );
-    $cfs->Limit( FIELD => 'Name', VALUE => 'RTIR Constituency', CASESENSITIVE => 0 );
-    $cf = $cfs->First;
-    ok $cf, 'have a field';
-    ok $cf->id, 'with some ID';
-}
-
-RT::Test->started_ok;
-my $rtir_user = rtir_user();
-my $agent = default_agent();
-
-diag "create an IR with GOVNET constituency and create a new "
-    . "incident for the IR, we want it to inherit by default"
-        if $ENV{'TEST_VERBOSE'};
-{
-    my $ir_id = $agent->create_rtir_ticket_ok(
-        'Incident Reports - GOVNET',
-        { Subject => "test" },
-    );
-    ok $ir_id, "created IR #$ir_id";
-    $agent->display_ticket( $ir_id);
-
-    my $inc_id = $agent->create_incident_for_ir(
-        $ir_id, { Subject => "test" },
-    );
-
-    my $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $inc_id );
-    ok $ticket->id, 'loaded ticket';
-    is $ticket->QueueObj->Name,
-        'Incidents - GOVNET', 'correct value';
-}
-
-diag "create an IR and check that we couldn't change constituency"
-    ." value during creation of new linked incident" if $ENV{'TEST_VERBOSE'};
-{
-    # create an IR
-    my $ir_id = $agent->create_rtir_ticket_ok('Incident Reports - GOVNET',
-        { Subject => "test" },
-    );
-    ok $ir_id, "created ticket #$ir_id";
-    $agent->display_ticket( $ir_id);
-    $agent->content_like( qr/GOVNET/, "value on the page" );
-    my $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $ir_id );
-    ok $ticket->id, 'loaded ticket';
-    is $ticket->QueueObj->Name, 'Incident Reports - GOVNET', 'correct value';
-
-    # click [new] near 'incident', set another constituency and create
-    $agent->follow_link_ok({text => 'New'}, "go to 'New Incident' page");
-    my $form = $agent->form_number(3);
-    $agent->click('CreateIncident');
-    is $agent->status, 200, "Attempted to create the ticket";
-
-    DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-    # Incident has the same value 
-    my $inc_id = $agent->get_ticket_id( );
-    $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $inc_id );
-    ok $ticket->id, 'loaded ticket';
-    is $ticket->QueueObj->Name, 'Incidents - GOVNET', 'correct value';
-
-    # And the report too
-    $ticket = RT::Ticket->new( $RT::SystemUser );
-    $ticket->Load( $ir_id );
-    ok $ticket->id, 'loaded ticket';
-    is $ticket->QueueObj->Name, 'Incident Reports - GOVNET', 'correct value';
-}
-
-diag "create an incident with EDUNET, then try to create children using"
-    ." Incident input field and different constituency. Should be rejected."
-        if $ENV{'TEST_VERBOSE'};
-{
-    my $incident_id = $agent->create_rtir_ticket_ok(
-        'Incidents - EDUNET',
-        { Subject => "test" },
-    );
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $incident_id );
-        ok $ticket->id, 'loaded ticket';
-        is $ticket->QueueObj->Name, 'Incidents - EDUNET',
-            'correct value';
-    }
-
-    foreach my $queue( 'Incident Reports', 'Investigations', 'Blocks' ) {
-        diag "create a ticket in the '$queue - GOVNET' queue" if $ENV{'TEST_VERBOSE'};
-
-        my $id = $agent->create_rtir_ticket(
-            $queue. ' - GOVNET',
-            {
-                Subject => "test constituency",
-            },
-        );
-        ok !$id, 'ticket was not created';
-        $agent->content_like(
-            qr/choose the same value for a new ticket or use another Incident/mi,
-            'creation rejected because of not matching constituency'
-        );
-    }
-}
-
-diag "create an incident with EDUNET and check that we can create children"
-    . " with the same constituency and operation is not rejected"
-        if $ENV{'TEST_VERBOSE'};
-{
-    my $incident_id = $agent->create_rtir_ticket_ok(
-        'Incidents - EDUNET',
-        { Subject => "test" },
-    );
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $incident_id );
-        ok $ticket->id, 'loaded ticket';
-        is $ticket->QueueObj->Name ,
-            'Incidents - EDUNET', 'correct value';
-    }
-
-    foreach my $queue( 'Incident Reports', 'Investigations', 'Blocks' ) {
-        diag "create a ticket in the '$queue - EDUNET' queue" if $ENV{'TEST_VERBOSE'};
-
-        my $id = $agent->create_rtir_ticket_ok(
-            $queue . ' - EDUNET',
-            {
-                Subject => "test constituency",
-                Incident => $incident_id,
-            },
-        );
-
-        $agent->display_ticket( $id);
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-        
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $id );
-            ok $ticket->id, 'loaded ticket';
-            is uc $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency'),
-                'EDUNET', 'correct value';
-        } {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $incident_id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency'),
-                'EDUNET', 'incident still has the same value';
-        }
-        $agent->ticket_is_linked_to_inc( $id, $incident_id);
-    }
-}
-
-diag "create an IR create an Incident with different constituency"
-    ." and goto [Link] IR, we shouldn't see an IR there"
-        if $ENV{'TEST_VERBOSE'};
-{
-    # an IR
-    my $ir_id = $agent->create_rtir_ticket_ok(
-        'Incident Reports - GOVNET',
-        { Subject => "test" }
-    );
-    $agent->display_ticket( $ir_id);
-    $agent->content_like( qr/GOVNET/, "value on the page" );
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $ir_id );
-        ok $ticket->id, 'loaded ticket';
-        is $ticket->QueueObj->Name, 'Incident Reports - GOVNET', 'correct value';
-        is $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency'),
-            'GOVNET', 'correct value';
-        $ticket->Subject("incident report #$ir_id");
-    }
-
-    # an IR
-    my $inc_id = $agent->create_rtir_ticket_ok('Incidents - EDUNET',
-        { Subject => "test" }, 
-    );
-    $agent->display_ticket( $inc_id);
-    $agent->content_like( qr/EDUNET/, "value on the page" );
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $inc_id );
-        ok $ticket->id, 'loaded ticket';
-        is $ticket->QueueObj->Name, 'Incidents - EDUNET', 'correct value';
-        is $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency'),
-            'EDUNET', 'correct value';
-    }
-    $agent->get_ok(
-        $agent->rt_base_url ."/RTIR/Link/ToIncident/?id=$inc_id&"
-        ."Lifecycle=incident_report&Query=id%3D$ir_id"
-    );
-    $agent->content_unlike(qr/incident report #$ir_id/, 'no IR on the page');
-}
-
-
-diag "check that we can change constituency of an unlinked ticket using 'Edit' page"
-    if $ENV{'TEST_VERBOSE'};
-{
-    # blocks are always linked to an incident
-    foreach my $queue( 'Incidents', 'Incident Reports', 'Investigations' ) {
-        my $id = $agent->create_rtir_ticket_ok(
-            $queue .' - GOVNET',
-            { Subject => "test constituency" },
-        );
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency'),
-                'GOVNET', 'correct value';
-        }
-        
-        $agent->display_ticket( $id);
-        $agent->follow_link( text => 'Edit' );
-        $agent->form_number(3);
-        $agent->select("Object-RT::Ticket-$id-CustomField-". $cf->id ."-Values" => 'EDUNET' );
-        $agent->click('SaveChanges');
-        $agent->content_like(qr/Constituency .* changed to EDUNET/mi, 'field is changed');
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $id );
-            ok $ticket->id, 'loaded ticket';
-            is uc $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency'),
-                'EDUNET', 'correct value';
-        }
-    }
-}
-
-diag "check that we can change constituency of an unlinked ticket using 'Edit' page"
-    if $ENV{'TEST_VERBOSE'};
-{
-    my $incident_id = $agent->create_rtir_ticket_ok(
-        'Incidents - EDUNET',
-        { Subject => "test" },
-    );
-    {
-        my $ticket = RT::Ticket->new( $RT::SystemUser );
-        $ticket->Load( $incident_id );
-        ok $ticket->id, 'loaded ticket';
-        is $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency'),
-            'EDUNET', 'correct value';
-    }
-
-    foreach my $queue( 'Blocks', 'Incident Reports', 'Investigations' ) {
-        my $id = $agent->create_rtir_ticket_ok(
-            $queue." - EDUNET",
-            {
-                Subject => "test constituency",
-                Incident => $incident_id,
-            },
-        );
-        DBIx::SearchBuilder::Record::Cachable::FlushCache();
-        {
-            my $ticket = RT::Ticket->new( $RT::SystemUser );
-            $ticket->Load( $id );
-            ok $ticket->id, 'loaded ticket';
-            is $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency'),
-                'EDUNET', 'correct value';
-        }
-        
-        $agent->display_ticket( $id);
-        $agent->follow_link( text => 'Edit' );
-        my $form = $agent->form_number(3);
-        ok !eval { $form->value('Constituency') }, 'no constituency hidden field';
-        ok !$form->find_input( "Object-RT::Ticket-$id-CustomField-". $cf->id ."-Values" ),
-            'no constituency select box';
-    }
-
-    # check incident as it's linked now
-    $agent->display_ticket( $incident_id);
-    $agent->follow_link( text => 'Edit' );
-    my $form = $agent->form_number(3);
-    ok !eval { $form->value('Constituency') }, 'no constituency hidden field';
-    ok !$form->find_input( "Object-RT::Ticket-$incident_id-CustomField-". $cf->id ."-Values" ),
-        'no constituency select box';
-}
-
-
-undef $agent;
-done_testing;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list