[Rt-commit] rt branch, googleish-refactor, updated. rt-3.8.5-207-g56ead7b
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Sun Oct 11 22:34:56 EDT 2009
The branch, googleish-refactor has been updated
via 56ead7bb06097b012362a77988be1ebcb90c2550 (commit)
from f545b3456d48ae265778c9f643e092c3d3f6d6ba (commit)
Summary of changes:
t/web/googleish_search.t | 84 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 84 insertions(+), 0 deletions(-)
create mode 100644 t/web/googleish_search.t
- Log -----------------------------------------------------------------
commit 56ead7bb06097b012362a77988be1ebcb90c2550
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Oct 12 10:16:23 2009 +0800
add t/web/googleish_search.t
diff --git a/t/web/googleish_search.t b/t/web/googleish_search.t
new file mode 100644
index 0000000..91033a7
--- /dev/null
+++ b/t/web/googleish_search.t
@@ -0,0 +1,84 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use RT::Test tests => 43;
+my ($baseurl, $m) = RT::Test->started_ok;
+my $url = $m->rt_base_url;
+
+my $queue = RT::Queue->new($RT::SystemUser);
+$queue->Create( Name => 'other' );
+ok( $queue->id, 'created queue other');
+
+my $ticket_found_1 = RT::Ticket->new($RT::SystemUser);
+my $ticket_found_2 = RT::Ticket->new($RT::SystemUser);
+my $ticket_not_found = RT::Ticket->new($RT::SystemUser);
+
+$ticket_found_1->Create(
+ Subject => 'base ticket 1'.$$,
+ Queue => 'general',
+ Owner => 'root',
+ Requestor => 'customsearch at localhost',
+ Content => 'this is base ticket 1',
+);
+ok( $ticket_found_1->id, 'created ticket for custom search');
+
+
+$ticket_found_2->Create(
+ Subject => 'base ticket 2'.$$,
+ Queue => 'general',
+ Owner => 'root',
+ Requestor => 'customsearch at localhost',
+ Content => 'this is base ticket 2',
+);
+ok( $ticket_found_2->id, 'created ticket for custom search');
+
+$ticket_not_found = RT::Ticket->new($RT::SystemUser);
+$ticket_not_found->Create(
+ Subject => 'not found subject' . $$,
+ Queue => 'other',
+ Owner => 'nobody',
+ Requestor => 'notfound at localhost',
+ Content => 'this is not found content',
+);
+ok( $ticket_not_found->id, 'created ticket for custom search');
+
+ok($m->login, 'logged in');
+
+my @queries = (
+ 'base ticket', 'root',
+ 'customsearch at localhost', 'requestor:customsearch',
+ 'subject:base', 'subject:"base ticket"',
+ 'queue:general', 'owner:root',
+);
+
+for my $q (@queries) {
+ $m->form_with_fields('q');
+ $m->field( q => $q );
+ $m->submit;
+ $m->content_contains( 'base ticket 1', 'base ticket 1 is found' );
+ $m->content_contains( 'base ticket 2', 'base ticket 2 is found' );
+ $m->content_lacks( 'not found subject', 'not found ticket is not found' );
+}
+
+$ticket_not_found->SetStatus('open');
+is( $ticket_not_found->Status, 'open', 'status of not found ticket is open' );
+ at queries = qw/new status:new/;
+for my $q (@queries) {
+ $m->form_with_fields('q');
+ $m->field( q => $q );
+ $m->submit;
+ $m->content_contains( 'base ticket 1', 'base ticket 1 is found' );
+ $m->content_contains( 'base ticket 2', 'base ticket 2 is found' );
+ $m->content_lacks( 'not found subject', 'not found ticket is not found' );
+}
+
+ at queries = ( 'fulltext:"base ticket 1"', "'base ticket 1'" );
+for my $q (@queries) {
+ $m->form_with_fields('q');
+ $m->field( q => $q );
+ $m->submit;
+ $m->content_contains( 'base ticket 1', 'base ticket 1 is found' );
+ $m->content_lacks( 'base ticket 2', 'base ticket 2 is not found' );
+ $m->content_lacks( 'not found subject', 'not found ticket is not found' );
+}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list