[Bps-public-commit] RT-Extension-SLA branch, master, updated. 0.04-7-g29a2506

Ruslan Zakirov ruz at bestpractical.com
Sat Jul 30 20:13:41 EDT 2011


The branch, master has been updated
       via  29a2506e35303d123c56940897b85f0da1097585 (commit)
       via  97071707926e6e39eb1d7e0e8e20c20312f29ee9 (commit)
       via  d395d80579c2c2629702c0481416b6b694ce4bba (commit)
       via  9464ca410c7a62d28ee5f8815f7e3bbbe73de168 (commit)
       via  28ae2b1e9b97fe8b3cb54c508b15167c78b84e58 (commit)
       via  8bc9891b4cdcea8656d4920b09357b0bb9d085e6 (commit)
       via  6a435e124abacf9abae7e9a48e8b81955e07661a (commit)
      from  be4d67e034e19287764c3efae6abee1515845b6e (commit)

Summary of changes:
 .gitignore                             |    3 +-
 Changes                                |    5 ++++
 MANIFEST                               |    2 +-
 META.yml                               |    2 +-
 lib/RT/Condition/SLA_RequireDefault.pm |    4 ++-
 lib/RT/Extension/SLA.pm                |    2 +-
 lib/RT/Extension/SLA/Test.pm           |   39 ++++++++++++++++++++++++++++++++
 t/basics.t                             |    3 +-
 t/business_hours.t                     |   23 ++++--------------
 t/due.t                                |   26 ++++++--------------
 t/queue.t                              |   16 +-----------
 t/starts.t                             |   25 +++++---------------
 t/utils.pl                             |   11 ---------
 13 files changed, 74 insertions(+), 87 deletions(-)
 create mode 100644 lib/RT/Extension/SLA/Test.pm
 delete mode 100644 t/utils.pl

- Log -----------------------------------------------------------------
commit 6a435e124abacf9abae7e9a48e8b81955e07661a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Jul 31 03:55:13 2011 +0400

    don't set default SLA for non-tickets
    
    eg RT::Ticket with type other than 'ticket',
    for example reminder

diff --git a/lib/RT/Condition/SLA_RequireDefault.pm b/lib/RT/Condition/SLA_RequireDefault.pm
index 1338c44..f85d283 100644
--- a/lib/RT/Condition/SLA_RequireDefault.pm
+++ b/lib/RT/Condition/SLA_RequireDefault.pm
@@ -16,7 +16,9 @@ value set.
 sub IsApplicable {
     my $self = shift;
     return 0 unless $self->TransactionObj->Type eq 'Create';
-    return 0 if $self->TicketObj->FirstCustomFieldValue('SLA');
+    my $ticket = $self->TicketObj;
+    return 0 unless lc($ticket->Type) eq 'ticket';
+    return 0 if $ticket->FirstCustomFieldValue('SLA');
     return 0 unless $self->SLAIsApplied;
     return 1;
 }

commit 8bc9891b4cdcea8656d4920b09357b0bb9d085e6
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Jul 31 03:57:45 2011 +0400

    switch tests over RT::Test

diff --git a/lib/RT/Extension/SLA/Test.pm b/lib/RT/Extension/SLA/Test.pm
new file mode 100644
index 0000000..d28cf06
--- /dev/null
+++ b/lib/RT/Extension/SLA/Test.pm
@@ -0,0 +1,39 @@
+use strict;
+use warnings;
+
+### after: use lib qw(@RT_LIB_PATH@);
+use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
+
+package RT::Extension::SLA::Test;
+
+our @ISA;
+BEGIN {
+    local $@;
+    eval { require RT::Test; 1 } or do {
+        require Test::More;
+        Test::More::BAIL_OUT(
+            "requires 3.8 to run tests. Error:\n$@\n"
+            ."You may need to set PERL5LIB=/path/to/rt/lib"
+        );
+    };
+    push @ISA, 'RT::Test';
+}
+
+sub import {
+    my $class = shift;
+    my %args  = @_;
+
+    $args{'requires'} ||= [];
+    if ( $args{'testing'} ) {
+        unshift @{ $args{'requires'} }, 'RT::Extension::SLA';
+    } else {
+        $args{'testing'} = 'RT::Extension::SLA';
+    }
+
+    $class->SUPER::import( %args );
+    $class->export_to_level(1);
+
+    require RT::Extension::SLA;
+}
+
+1;
\ No newline at end of file
diff --git a/t/basics.t b/t/basics.t
index 8d73e46..f9e9ed7 100644
--- a/t/basics.t
+++ b/t/basics.t
@@ -3,9 +3,8 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use RT::Extension::SLA::Test tests => 4, nodb => 1;
 
 use_ok 'RT::Extension::SLA';
 
-
 1;
diff --git a/t/business_hours.t b/t/business_hours.t
index ae7b29c..e4c7018 100644
--- a/t/business_hours.t
+++ b/t/business_hours.t
@@ -3,25 +3,12 @@
 use strict;
 use warnings;
 
+use Test::MockTime qw( :all );
+use RT::Extension::SLA::Test tests => 9;
 
-use Test::More tests => 9;
-
-require 't/utils.pl';
-
-use_ok 'RT';
-RT::LoadConfig();
-$RT::LogToScreen = $ENV{'TEST_VERBOSE'} ? 'debug': 'warning';
-
-# XXX, TODO 
 # we assume the RT's Timezone is UTC now, need a smart way to get over that.
-$ENV{'TZ'} = $RT::Timezone = 'GMT';
-
-RT::Init();
-
-use_ok 'RT::Ticket';
-use_ok 'RT::Extension::SLA';
-
-use Test::MockTime qw( :all );
+$ENV{'TZ'} = 'GMT';
+RT->Config->Set( Timezone => 'GMT' );
 
 diag 'check business hours';
 {
diff --git a/t/due.t b/t/due.t
index c021189..e380232 100644
--- a/t/due.t
+++ b/t/due.t
@@ -3,17 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 72;
-
-require 't/utils.pl';
-
-use_ok 'RT';
-RT::LoadConfig();
-$RT::LogToScreen = $ENV{'TEST_VERBOSE'} ? 'debug': 'warning';
-RT::Init();
-
-use_ok 'RT::Ticket';
-use_ok 'RT::Extension::SLA';
+use RT::Extension::SLA::Test tests => 72;
 
 diag 'check change of Due date when SLA for a ticket is changed';
 {
diff --git a/t/queue.t b/t/queue.t
index 980bae3..13b8129 100644
--- a/t/queue.t
+++ b/t/queue.t
@@ -3,20 +3,8 @@
 use strict;
 use warnings;
 
-use Test::More tests => 9;
-
-require 't/utils.pl';
-
-use_ok 'RT';
-RT::LoadConfig();
-$RT::LogToScreen = $ENV{'TEST_VERBOSE'} ? 'debug': 'warning';
-RT::Init();
-
-use_ok 'RT::Ticket';
-use_ok 'RT::Extension::SLA';
-
 use Test::MockTime qw( :all );
-
+use RT::Extension::SLA::Test tests => 9;
 
 my $queue = RT::Queue->new($RT::SystemUser);
 $queue->Load('General');
diff --git a/t/starts.t b/t/starts.t
index 11c38e2..e53fea6 100644
--- a/t/starts.t
+++ b/t/starts.t
@@ -3,25 +3,12 @@
 use strict;
 use warnings;
 
-use Test::More tests => 12; 
-
-require 't/utils.pl';
-
-use_ok 'RT';
-RT::LoadConfig();
-$RT::LogToScreen = $ENV{'TEST_VERBOSE'} ? 'debug': 'warning';
+use Test::MockTime qw( :all );
+use RT::Extension::SLA::Test tests => 12;
 
-# XXX, TODO
 # we assume the RT's Timezone is UTC now, need a smart way to get over that.
-$ENV{'TZ'} = $RT::Timezone = 'GMT';
-
-RT::Init();
-
-use_ok 'RT::Ticket';
-
-use_ok 'RT::Extension::SLA';
-
-use Test::MockTime qw( :all );
+$ENV{'TZ'} = 'GMT';
+RT->Config->Set( Timezone => 'GMT' );
 
 my $bhours = RT::Extension::SLA->BusinessHours;
 
diff --git a/t/utils.pl b/t/utils.pl
deleted file mode 100644
index 800b719..0000000
--- a/t/utils.pl
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-BEGIN {
-### after:     push @INC, qw(@RT_LIB_PATH@);
-    push @INC, qw(/opt/rt3/local/lib /opt/rt3/lib);
-}
-
-1;

commit 28ae2b1e9b97fe8b3cb54c508b15167c78b84e58
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Jul 31 04:01:10 2011 +0400

    update .gitignore with t/tmp and *.tar.gz

diff --git a/.gitignore b/.gitignore
index 210eea6..ef57f35 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
 Makefile
 pm_to_blib
 blib/
-
+t/tmp/
+*.tar.gz

commit 9464ca410c7a62d28ee5f8815f7e3bbbe73de168
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Jul 31 04:02:28 2011 +0400

    update manifest

diff --git a/MANIFEST b/MANIFEST
index 22c271a..62f670e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -23,6 +23,7 @@ lib/RT/Condition/SLA_RequireDefault.pm
 lib/RT/Condition/SLA_RequireDueSet.pm
 lib/RT/Condition/SLA_RequireStartsSet.pm
 lib/RT/Extension/SLA.pm
+lib/RT/Extension/SLA/Test.pm
 lib/RT/Queue_SLA.pm
 Makefile.PL
 MANIFEST			This list of files
@@ -32,4 +33,3 @@ t/business_hours.t
 t/due.t
 t/queue.t
 t/starts.t
-t/utils.pl

commit d395d80579c2c2629702c0481416b6b694ce4bba
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Jul 31 04:06:56 2011 +0400

    make tests less verbose by default

diff --git a/t/business_hours.t b/t/business_hours.t
index e4c7018..1b177bb 100644
--- a/t/business_hours.t
+++ b/t/business_hours.t
@@ -10,7 +10,7 @@ use RT::Extension::SLA::Test tests => 9;
 $ENV{'TZ'} = 'GMT';
 RT->Config->Set( Timezone => 'GMT' );
 
-diag 'check business hours';
+diag 'check business hours' if $ENV{'TEST_VERBOSE'};
 {
 
     no warnings 'once';
diff --git a/t/due.t b/t/due.t
index e380232..cefdb3d 100644
--- a/t/due.t
+++ b/t/due.t
@@ -5,7 +5,7 @@ use warnings;
 
 use RT::Extension::SLA::Test tests => 72;
 
-diag 'check change of Due date when SLA for a ticket is changed';
+diag 'check change of Due date when SLA for a ticket is changed' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => '2',
@@ -37,7 +37,7 @@ diag 'check change of Due date when SLA for a ticket is changed';
     is $new_due, $orig_due+2*60*60, 'difference is two hours';
 }
 
-diag 'when not requestor creates a ticket, we dont set due date';
+diag 'when not requestor creates a ticket, we dont set due date' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => '2',
@@ -60,7 +60,7 @@ diag 'when not requestor creates a ticket, we dont set due date';
     ok $due <= 0, 'Due date is not set';
 }
 
-diag 'check that reply to requestors unset due date';
+diag 'check that reply to requestors unset due date' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => '2',
@@ -158,7 +158,7 @@ diag 'check that reply to requestors unset due date';
     }
 }
 
-diag 'check that reply to requestors dont unset due date with KeepInLoop';
+diag 'check that reply to requestors dont unset due date with KeepInLoop' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => '2',
@@ -268,7 +268,7 @@ diag 'check that reply to requestors dont unset due date with KeepInLoop';
     }
 }
 
-diag 'check that replies dont affect resolve deadlines';
+diag 'check that replies dont affect resolve deadlines' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => '2',
@@ -332,7 +332,7 @@ diag 'check that replies dont affect resolve deadlines';
     }
 }
 
-diag 'check that owner is not treated as requestor';
+diag 'check that owner is not treated as requestor' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => '2',
@@ -365,7 +365,7 @@ diag 'check that owner is not treated as requestor';
     }
 }
 
-diag 'check that response deadline is left alone when there is no requestor';
+diag 'check that response deadline is left alone when there is no requestor' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => '2',
diff --git a/t/queue.t b/t/queue.t
index 13b8129..3a29fe4 100644
--- a/t/queue.t
+++ b/t/queue.t
@@ -11,7 +11,7 @@ $queue->Load('General');
 
 my $queue_sla = RT::Attribute->new($RT::SystemUser);
 
-diag 'check set of Due date with Queue default SLA';
+diag 'check set of Due date with Queue default SLA' if $ENV{'TEST_VERBOSE'};
 {
 
     # add default SLA for 'General';
diff --git a/t/starts.t b/t/starts.t
index e53fea6..6fc696d 100644
--- a/t/starts.t
+++ b/t/starts.t
@@ -12,7 +12,7 @@ RT->Config->Set( Timezone => 'GMT' );
 
 my $bhours = RT::Extension::SLA->BusinessHours;
 
-diag 'check Starts date';
+diag 'check Starts date' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => 'standard',
@@ -55,7 +55,7 @@ diag 'check Starts date';
     restore_time();
 }
 
-diag 'check Starts date with StartImmediately enabled';
+diag 'check Starts date with StartImmediately enabled' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
         Default => 'start immediately',

commit 97071707926e6e39eb1d7e0e8e20c20312f29ee9
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Jul 31 04:09:49 2011 +0400

    update changelog

diff --git a/Changes b/Changes
index 4fcd83d..a5072b2 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+0.05 Sun Jul 31 04:08:45 MSD 2011
+
+    * don't set default SLA for reminders
+    * switch over RT::Test in tests
+
 0.04 Fri Jun  3 02:02:15 MSD 2011
 
     * RT 4.0 compatibility fix

commit 29a2506e35303d123c56940897b85f0da1097585
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Jul 31 04:12:08 2011 +0400

    bump version, 0.05

diff --git a/META.yml b/META.yml
index b797e27..a1f0e45 100644
--- a/META.yml
+++ b/META.yml
@@ -24,4 +24,4 @@ requires:
   perl: 5.8.0
 resources:
   license: http://opensource.org/licenses/gpl-2.0.php
-version: 0.04
+version: 0.05
diff --git a/lib/RT/Extension/SLA.pm b/lib/RT/Extension/SLA.pm
index 2a0f8bd..b533b00 100644
--- a/lib/RT/Extension/SLA.pm
+++ b/lib/RT/Extension/SLA.pm
@@ -4,7 +4,7 @@ use warnings;
 
 package RT::Extension::SLA;
 
-our $VERSION = '0.04';
+our $VERSION = '0.05';
 
 =head1 NAME
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list