[Rt-commit] rt branch, 3.8-rss-authstring, updated. rt-3.8.7-62-g2553cfa

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Feb 11 02:33:44 EST 2010


The branch, 3.8-rss-authstring has been updated
       via  2553cfaca9d46e8425ec8e8c905e42452d7cddba (commit)
      from  de2c0ee92180802ee93f9a289789ebfebc7cc482 (commit)

Summary of changes:
 t/web/search_rss.t |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 t/web/search_rss.t

- Log -----------------------------------------------------------------
commit 2553cfaca9d46e8425ec8e8c905e42452d7cddba
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Feb 11 15:31:35 2010 +0800

    add rss tests for ticket search result

diff --git a/t/web/search_rss.t b/t/web/search_rss.t
new file mode 100644
index 0000000..454dc03
--- /dev/null
+++ b/t/web/search_rss.t
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+use strict;
+
+use RT::Test tests => 36;
+RT::Test->started_ok;
+
+my $ticket = RT::Ticket->new($RT::SystemUser);
+for ( 1 .. 5 ) {
+    $ticket->Create(
+        Subject   => 'Ticket ' . $_,
+        Queue     => 'General',
+        Owner     => 'root',
+        Requestor => 'rss at localhost',
+    );
+}
+
+my $agent = RT::Test::Web->new;
+ok $agent->login('root', 'password'), 'logged in as root';
+
+$agent->get_ok('/Search/Build.html');
+$agent->form_name('BuildQuery');
+$agent->field('idOp', '>');
+$agent->field('ValueOfid', '0');
+$agent->submit('DoSearch');
+$agent->follow_link_ok({text=>'Show Results'});
+
+for ( 1 .. 5 ) {
+    $agent->content_contains('Ticket ' . $_);
+}
+my $rdf_path = $agent->uri->path_query;
+$rdf_path =~ s!Results\.html!Results.rdf!;
+
+$agent->follow_link_ok( { text => 'RSS' } );
+my $noauth_uri = $agent->uri;
+is( $agent->content_type, 'application/rss+xml', 'content type' );
+for ( 1 .. 5 ) {
+    $agent->content_contains('Ticket ' . $_);
+}
+my $rss_content = $agent->content;
+$agent->get_ok($rdf_path);
+is($agent->content, $rss_content, 'old Results.rdf still works');
+
+SKIP: {
+    eval { require XML::Simple; };
+    skip 'no XML::Simple found', 6 if $@;
+    my $rss = XML::Simple::XMLin( $rss_content );
+    is( scalar @{ $rss->{item} }, 5, 'item number' );
+    for ( 1 .. 5 ) {
+        is( $rss->{item}[$_-1]{title}, 'Ticket ' . $_, 'title' . $_ );
+    }
+}
+
+# not login at all
+my $agent_b = RT::Test::Web->new;
+$agent_b->get_ok($noauth_uri);
+is( $agent_b->content_type, 'application/rss+xml', 'content type' );
+is( $agent_b->content, $rss_content, 'content' );
+$agent_b->get_ok('/', 'back to homepage');
+$agent_b->content_lacks( 'Logout', 'still not login' );
+
+# lets login as another user
+my $user_b = RT::Test->load_or_create_user(
+    Name => 'user_b', Password => 'password',
+);
+ok $user_b && $user_b->id, 'loaded or created user';
+$agent_b->login('user_b', 'password'), 'logged in as user B';
+$agent_b->get_ok($noauth_uri);
+is( $agent_b->content_type, 'application/rss+xml', 'content type' );
+is( $agent_b->content, $rss_content, 'content' );
+$agent_b->get_ok('/', 'back to homepage');
+$agent_b->content_contains( 'Logout', 'still loggedin' );
+$agent_b->content_contains( 'user_b', 'still loggedin as user_b' );
+

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


More information about the Rt-commit mailing list