[Bps-public-commit] RT-Extension-TicketLocking branch, master, updated. 0.12-9-g0162e17

Kevin Falcone falcone at bestpractical.com
Tue Mar 25 17:14:38 EDT 2014


The branch, master has been updated
       via  0162e1777b917810aef373d3bd49df671e6173ca (commit)
       via  d62ab7bc7d52db7be134f53383f79b9937b3143c (commit)
       via  994a257bff152d7dc7e22fc4b09e85fcbffde4d9 (commit)
       via  4f846594fbbdbcf79d27d226282262be501ddc76 (commit)
       via  4ec5691c060807babd60982d6c0484feff4afd6d (commit)
       via  a713ecf8380e148fa1b6fbe174cd961ac8aaf142 (commit)
       via  b5b3f2c1ac5135d600e0b60de80465403549b8e3 (commit)
       via  b13fd32cece6119adb1865d9d713541e9cd3ecfc (commit)
       via  bef6da81dbf6060675559511364de2f9ed4056a6 (commit)
      from  17b999c205011f587970b13ba59c70d6c2d45eb7 (commit)

Summary of changes:
 .gitignore              |  1 +
 META.yml                |  2 +-
 Makefile.PL             |  2 +-
 t/callbacks.t           | 50 -------------------------------------------------
 {t => xt}/rt.t          | 24 ++++++++++++------------
 {t => xt}/rtir.t        |  0
 {t => xt}/test_suite.pl | 15 +++------------
 7 files changed, 18 insertions(+), 76 deletions(-)
 delete mode 100644 t/callbacks.t
 rename {t => xt}/rt.t (91%)
 rename {t => xt}/rtir.t (100%)
 rename {t => xt}/test_suite.pl (97%)

- Log -----------------------------------------------------------------
commit bef6da81dbf6060675559511364de2f9ed4056a6
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 13:01:16 2014 -0400

    Delete this test, it's quite broken.
    
    This tests to see if your installed RT has the relevant callbacks, but
    it can't possibly work on modern RTs (in fact I doubt it worked properly
    on 3.8 since it never looked in plugins for the RTIR files).  It also
    hardcoded a bunch of /opt/rt3 paths despite having support for knowing
    RT's real installed path in other tests.
    
    It also doesn't understand that autohandler callbacks moved to lib/ in
    later 3.8s.
    
    The utility in fixing this greatly outweighs the utility in having the
    test.

diff --git a/t/callbacks.t b/t/callbacks.t
deleted file mode 100644
index 84b60dc..0000000
--- a/t/callbacks.t
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More qw/no_plan/;
-
-require "t/test_suite.pl";
-
-my $ok = 1;
-
-use File::Find;
-find( {
-    no_chdir => 1,
-    wanted   => sub {
-        return if /(?:\.(?:jpe?g|png|gif|rej)|\~)$/i;
-        if ( m{/\.svn$} ) {
-            $File::Find::prune = 1;
-            return;
-        }
-        return unless -f $_;
-        diag "testing $_" if $ENV{'TEST_VERBOSE'};
-        check_callback( $_ ) and return;
-        $ok = 0;
-        diag "error in ${File::Find::name}:\n$@";
-    },
-}, 'html/Callbacks/');
-ok($ok, "all callbacks are ok");
-
-
-sub check_callback {
-    my $path = shift;
-    my ($comp, $callback) = ($path =~ m{^html/Callbacks/[^/]+/(.*)/([^/]+)$});
-
-    my $comp_path = "/opt/rt3/share/html/$comp";
-    $comp_path = "/opt/rt3/html/$comp" unless -e $comp_path;
-
-    open my $fh, '<', $comp_path or die "couldn't open '$comp_path': $!";
-    my $text = do { local $/; <$fh> };
-    close $fh;
-
-    if ( $callback eq 'Default' ) {
-        return $text =~ /\$m->callback/;
-    } else {
-        return $text =~ /CallbackName\s*=>\s*'$callback'/;
-    }
-
-    return 1;
-}
-

commit b13fd32cece6119adb1865d9d713541e9cd3ecfc
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 13:12:10 2014 -0400

    Turn these into author tests

diff --git a/META.yml b/META.yml
index 9ad6882..281fb13 100644
--- a/META.yml
+++ b/META.yml
@@ -19,7 +19,7 @@ no_index:
   directory:
     - html
     - inc
-    - t
+    - xt
 requires:
   perl: 5.8.3
 resources:
diff --git a/Makefile.PL b/Makefile.PL
index 43a3335..2b70c5d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -16,7 +16,7 @@ unshift @INC, $local_lib_path, $lib_path;
 substitute( {
         RT_LIB_PATH => join( ' ', $local_lib_path, $lib_path ),
     },
-    't/test_suite.pl',
+    'xt/test_suite.pl',
 );
 
 
diff --git a/t/rt.t b/xt/rt.t
similarity index 100%
rename from t/rt.t
rename to xt/rt.t
diff --git a/t/rtir.t b/xt/rtir.t
similarity index 100%
rename from t/rtir.t
rename to xt/rtir.t
diff --git a/t/test_suite.pl b/xt/test_suite.pl
similarity index 100%
rename from t/test_suite.pl
rename to xt/test_suite.pl

commit b5b3f2c1ac5135d600e0b60de80465403549b8e3
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 14:20:33 2014 -0400

    Stop doing things manually
    
    Trust the test files to load RT::Test appropriately.
    Use helper functions to find eht ticket create page.
    Don't load the config again, clobbering RT::Test.

diff --git a/xt/test_suite.pl b/xt/test_suite.pl
index ccfe07e..2717681 100644
--- a/xt/test_suite.pl
+++ b/xt/test_suite.pl
@@ -8,21 +8,13 @@ use strict;
 use warnings;
 
 use HTTP::Cookies;
-use Test::More;
 
 ### after: use lib qw(@RT_LIB_PATH@);
 use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
 
-use RT;
-RT::LoadConfig();
-RT::Init();
-
 my $RTIR_TEST_USER = "rtir_test_user";
 my $RTIR_TEST_PASS = "rtir_test_pass";
 
-require RT::Test;
-use RT::Test::Web;
-
 sub default_agent {
     my $agent = new RT::Test::Web;
     $agent->cookie_jar( HTTP::Cookies->new );
@@ -288,10 +280,9 @@ sub create_ticket {
     my $fields = shift || {};
     my $cfs = shift || {};
 
-    $agent->get_ok(
-        "/Ticket/Create.html?Queue=$queue",
-        "Went to Create page in queue $queue",
-    );
+    my $q = RT::Test->load_or_create_queue(Name => $queue);
+
+    $agent->goto_create_ticket($q);
 
     #Enable test scripts to pass in the name of the owner rather than the ID
     if ( $fields->{'Owner'} && $fields->{'Owner'} !~ /^\d+$/ ) {

commit a713ecf8380e148fa1b6fbe174cd961ac8aaf142
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 14:22:11 2014 -0400

    remove unused code

diff --git a/xt/rt.t b/xt/rt.t
index b19ca7a..9946f5a 100644
--- a/xt/rt.t
+++ b/xt/rt.t
@@ -23,10 +23,6 @@ use_ok('RT::Extension::TicketLocking');
 
 my $agent = default_agent();
 
-my $root = new RT::Test::Web;
-$root->cookie_jar( HTTP::Cookies->new );
-ok $root->login('root', 'password'), 'logged in';
-
 my $SUBJECT = "foo " . rand;
 
 my $id = create_ticket($agent, 'General', {Subject => $SUBJECT});

commit 4ec5691c060807babd60982d6c0484feff4afd6d
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 14:22:24 2014 -0400

    Switch to modern RT::Test framwork
    
    Let RT load the extension and start the webserver.
    Keep the no-plan part of the old tests.

diff --git a/xt/rt.t b/xt/rt.t
index 9946f5a..f40d676 100644
--- a/xt/rt.t
+++ b/xt/rt.t
@@ -2,11 +2,13 @@
 
 use strict;
 use warnings;
-use Test::More qw/no_plan/;
 
-use HTTP::Cookies;
+use RT::Test testing => 'RT::Extension::TicketLocking', tests => undef;
+require "xt/test_suite.pl";
 
-require "t/test_suite.pl";
+
+my ($baseurl, $default_agent) = RT::Test->started_ok;
+diag($baseurl);
 
 my $queue = RT::Test->load_or_create_queue( Name => 'General' );
 ok $queue && $queue->id, 'loaded or created the queue';
@@ -85,6 +87,8 @@ $agent->click('SubmitTicket');
 diag("Submitted Comment form") if $ENV{'TEST_VERBOSE'};
 $agent->content_like(qr{<div class="locked-by-you">\s*You had this ticket locked for \d+ \w+\. It is now unlocked\.}ims, "Ticket #$id Auto lock is removed");
 
-
 #removes all user's locks
 $agent->follow_link_ok({text => 'Logout', n => '1'}, "Logging out rtir_test_user");
+
+undef $default_agent;
+done_testing;

commit 4f846594fbbdbcf79d27d226282262be501ddc76
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 14:25:56 2014 -0400

    Sleep otherwise when the autolock is cleared, it'll look like Duration is 0
    
    Duration 0 causes the message to not be printed to the screen.  There's
    a bug here around undef of course.

diff --git a/xt/rt.t b/xt/rt.t
index f40d676..19d2610 100644
--- a/xt/rt.t
+++ b/xt/rt.t
@@ -81,6 +81,7 @@ $agent->content_like(qr{<div class="locked-by-you">\s*You have locked this ticke
     $ticket->Load($id);
     my $lock = $ticket->Locked();
     ok( $lock && $lock->Content->{'Type'} eq 'Auto', "Lock is an Auto lock");
+    sleep 1; # submit too fast and Duration is 0
 }
 $agent->form_number(3);
 $agent->click('SubmitTicket');

commit 994a257bff152d7dc7e22fc4b09e85fcbffde4d9
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 14:28:36 2014 -0400

    Match the newer message we get
    
    Improve the debug message from running tests also.

diff --git a/xt/rt.t b/xt/rt.t
index 19d2610..fc18c04 100644
--- a/xt/rt.t
+++ b/xt/rt.t
@@ -31,7 +31,7 @@ my $id = create_ticket($agent, 'General', {Subject => $SUBJECT});
 ok $id, 'created a ticket';
 my $ticket = RT::Ticket->new(RT::SystemUser());
 $ticket->Load($id);
-ok $ticket->id, 'loaded ticket';
+ok $ticket->id, 'loaded ticket '.$id;
 
 $agent->follow_link_ok({text => 'Lock', n => '1'}, "Followed Lock link for Ticket #$id");
 $agent->content_like(qr{<div class="locked-by-you">\s*You have locked this ticket\.}ims, "Added a hard lock on Ticket $id");
@@ -68,8 +68,9 @@ $agent->click('SubmitTicket');
 diag("Submitted Comment form") if $ENV{'TEST_VERBOSE'};
 $agent->content_like(qr{<div class="locked-by-you">\s*You have had this ticket locked for \d+ \w+\.\s*</div>}ims, "Ticket #$id still locked after submitting comment");
 
+
 $agent->follow_link_ok({text => 'Unlock', n => '1'}, "Followed Unlock link for Ticket #$id");
-$agent->content_like(qr{<div class="locked-by-you">\s*You had this ticket locked for \d+ \w+\. It is now unlocked\.}ims, "Ticket #$id is not locked");
+$agent->content_like(qr{You have unlocked this ticket. It was locked for \d+ \w+\.}ims, "Ticket #$id is not locked");
 
 ###Testing auto lock###
 

commit d62ab7bc7d52db7be134f53383f79b9937b3143c
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 14:29:53 2014 -0400

    This gets tested by RT::Test

diff --git a/xt/rt.t b/xt/rt.t
index fc18c04..1251944 100644
--- a/xt/rt.t
+++ b/xt/rt.t
@@ -21,8 +21,6 @@ RT::Test->set_rights(
     Right     => [qw(SeeQueue CreateTicket OwnTicket ShowTicket ModifyTicket)],
 );
 
-use_ok('RT::Extension::TicketLocking');
-
 my $agent = default_agent();
 
 my $SUBJECT = "foo " . rand;

commit 0162e1777b917810aef373d3bd49df671e6173ca
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Mar 25 17:13:58 2014 -0400

    Ignore tmp files from author tests

diff --git a/.gitignore b/.gitignore
index f2f8440..3ae604e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ cover_db/
 nytprof/
 *.tar.gz
 *.sw[po]
+/xt/tmp

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



More information about the Bps-public-commit mailing list