[Rt-commit] r8487 - in rtir/branches/2.3-EXPERIMENTAL/t: .

ruz at bestpractical.com ruz at bestpractical.com
Thu Aug 9 19:21:45 EDT 2007


Author: ruz
Date: Thu Aug  9 19:21:44 2007
New Revision: 8487

Modified:
   rtir/branches/2.3-EXPERIMENTAL/t/013-custom-field-ip.t
   rtir/branches/2.3-EXPERIMENTAL/t/constituency/basics.t
   rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-inherit.t
   rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-no.t
   rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl

Log:
* split create_rtir_ticket into create_rtir_ticket and create_rtir_ticket_ok
** the first one doesn't check anymore if there is $id of a ticket on the page,
   so we can use it in tests where we actually don't want ticket to be created
** switch all tests to the second one function


Modified: rtir/branches/2.3-EXPERIMENTAL/t/013-custom-field-ip.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/013-custom-field-ip.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/013-custom-field-ip.t	Thu Aug  9 19:21:44 2007
@@ -49,7 +49,7 @@
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
 
         my $val = '192.168.20.'. ++$i;
-        my $id = create_rtir_ticket(
+        my $id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip",
@@ -77,7 +77,7 @@
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
 
         my $val = '192.168.20.'. ++$i;
-        my $id = create_rtir_ticket(
+        my $id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip in message",
@@ -105,7 +105,7 @@
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
 
         my $val = '172.16.'. ++$i .'/31'; # add two hosts
-        my $id = create_rtir_ticket(
+        my $id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip",
@@ -136,7 +136,7 @@
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
 
         my $val = '172.16.'. ++$i .'/31'; # add two hosts
-        my $id = create_rtir_ticket(
+        my $id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip in message",
@@ -166,7 +166,7 @@
     foreach my $queue( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
 
-        my $id = create_rtir_ticket(
+        my $id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip in message",

Modified: rtir/branches/2.3-EXPERIMENTAL/t/constituency/basics.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/constituency/basics.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/constituency/basics.t	Thu Aug  9 19:21:44 2007
@@ -87,7 +87,7 @@
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
 
         my $val = 'GOVNET';
-        my $id = create_rtir_ticket(
+        my $id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip",

Modified: rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-inherit.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-inherit.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-inherit.t	Thu Aug  9 19:21:44 2007
@@ -97,7 +97,7 @@
     . " incident's constituency is prefered even if another value's been selected"
         if $ENV{'TEST_VERBOSE'};
 {
-    my $incident_id = create_rtir_ticket(
+    my $incident_id = create_rtir_ticket_ok(
         $agent, 'Incidents',
         { Subject => "test" },
         { Constituency => 'EDUNET' },
@@ -113,7 +113,7 @@
     foreach my $queue( 'Incident Reports', 'Investigations', 'Blocks' ) {
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
 
-        my $id = create_rtir_ticket(
+        my $id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip",
@@ -147,11 +147,11 @@
     foreach my $queue( 'Incident Reports', 'Investigations', 'Blocks' ) {
         diag "create an incident for linking" if $ENV{'TEST_VERBOSE'};
 
-        my $incident_id = create_rtir_ticket(
+        my $incident_id = create_rtir_ticket_ok(
             $agent, 'Incidents', { Subject => "test" }, { Constituency => 'GOVNET' },
         );
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
-        my $child_id = create_rtir_ticket(
+        my $child_id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip",

Modified: rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-no.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-no.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-no.t	Thu Aug  9 19:21:44 2007
@@ -33,7 +33,7 @@
     . " constituency shouldn't propagate back to tickets"
     if $ENV{'TEST_VERBOSE'};
 {
-    my $incident_id = create_rtir_ticket(
+    my $incident_id = create_rtir_ticket_ok(
         $agent, 'Incidents',
         { Subject => "test" },
         { Constituency => 'EDUNET' },
@@ -49,7 +49,7 @@
     foreach my $queue( 'Incident Reports', 'Investigations', 'Blocks' ) {
         diag "create a ticket in the '$queue' queue" if $ENV{'TEST_VERBOSE'};
 
-        my $id = create_rtir_ticket(
+        my $id = create_rtir_ticket_ok(
             $agent, $queue,
             {
                 Subject => "test ip",

Modified: rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl	Thu Aug  9 19:21:44 2007
@@ -131,16 +131,16 @@
 }
 
 sub create_incident {
-    return create_rtir_ticket( shift, 'Incidents', @_ );
+    return create_rtir_ticket_ok( shift, 'Incidents', @_ );
 }
 sub create_ir {
-    return create_rtir_ticket( shift, 'Incident Reports', @_ );
+    return create_rtir_ticket_ok( shift, 'Incident Reports', @_ );
 }
 sub create_investigation {
-    return create_rtir_ticket( shift, 'Investigations', @_ );
+    return create_rtir_ticket_ok( shift, 'Investigations', @_ );
 }
 sub create_block {
-    return create_rtir_ticket( shift, 'Blocks', @_ );
+    return create_rtir_ticket_ok( shift, 'Blocks', @_ );
 }
 
 sub goto_create_rtir_ticket {
@@ -163,6 +163,15 @@
     $agent->form_number(3);
 }
 
+sub create_rtir_ticket_ok {
+    my $agent = shift;
+    my $queue = shift;
+
+    my $id = create_rtir_ticket( $agent, $queue, @_ );
+    ok $id, "Created ticket #$id in queue '$queue' successfully.";
+    return $id;
+}
+
 sub create_rtir_ticket
 {
     my $agent = shift;
@@ -192,11 +201,7 @@
     
     is ($agent->status, 200, "Attempted to create the ticket");
 
-    # Now see if we succeeded
-    my $id = get_ticket_id($agent);
-    ok ($id, "Created ticket #$id in queue '$queue' successfully.");
-
-    return $id;
+    return get_ticket_id($agent);
 }
 
 sub get_ticket_id {


More information about the Rt-commit mailing list