Commit bb3fee14 authored by Ruslan Zakirov's avatar Ruslan Zakirov
Browse files

remove xt/ directory

parent f32a75f5
......@@ -25,10 +25,8 @@ substitute(
RT_BIN_PATH => $bin_path,
RT_SBIN_PATH => $sbin_path,
},
qw(xt/utils.pl lib/RT/Extension/CommandByMail/Test.pm),
qw(lib/RT/Extension/CommandByMail/Test.pm),
);
author_tests('xt');
sign;
WriteAll();
use Test::More tests => 5;
BEGIN { require 'xt/utils.pl' }
BEGIN {
use_ok( 'RT' );
RT::LoadConfig();
use_ok( 'RT::Extension::CommandByMail' );
use_ok( 'RT::Interface::Email::Filter::TakeAction' );
}
diag( "Testing RT::Extension::CommandByMail $RT::Extension::CommandByMail::VERSION" );
my $new_config = RT->can('Config') && RT->Config->can('Get');
my @plugins = $new_config
? RT->Config->Get('Plugins')
: @RT::Plugins;
my @mail_plugins = $new_config
? RT->Config->Get('MailPlugins')
: @RT::MailPlugins;
my $complain = 0;
ok((grep { $_ eq 'RT::Extension::CommandByMail' } @plugins), "RT::Extension::CommandByMail is in your config's \@Plugins") or $complain = 1;
ok((grep { $_ eq 'Filter::TakeAction' } @mail_plugins), "Filter::TakeAction is in your config's \@MailPlugins") or $complain = 1;
if ($complain) {
diag "Please read through the entire INSTALL documentation for directions on how to set up your config for testing and using this plugin.";
}
#!perl -T
use Test::More;
eval "use Test::Pod::Coverage 1.04";
plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
all_pod_coverage_ok();
#!perl -T
use Test::More;
eval "use Test::Pod 1.14";
plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
all_pod_files_ok();
#!/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);
}
use RT;
RT::LoadConfig();
use IPC::Open2;
### after: our $mailgate = '@RT_BIN_PATH@/rt-mailgate';
our $mailgate = '/opt/rt3/bin/rt-mailgate';
die "Couldn't find mailgate ($mailgate) command" unless -f $mailgate;
$mailgate .= ' --debug';
$mailgate .= ' --url '. $RT::WebURL;
sub run_gate {
my %args = (
message => '',
action => 'correspond',
queue => 'General',
@_
);
my $cmd = $mailgate
." --queue '$args{'queue'}'"
." --action $args{'action'}"
." 2>&1";
DBIx::SearchBuilder::Record::Cachable->FlushCache;
my ($child_out, $child_in);
my $pid = open2($child_out, $child_in, $cmd);
print $child_in $args{'message'};
close $child_in;
my $result = do { local $/; <$child_out> };
return $result;
}
sub create_ticket_via_gate {
my $message = shift;
my $gate_result = run_gate( message => $message );
$gate_result =~ /Ticket: (\d+)/;
unless ( $1 ) {
print STDERR "Couldn't find ticket id in text:\n$gate_result";
}
return $1;
}
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment