Ignore:
Timestamp:
Jun 22, 2006, 3:30:44 PM (15 years ago)
Author:
nick
Message:

Support RSS and Atom for category and locale indicies, + test for this

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/t/53_show_index.t

    r785 r814  
    33use OpenGuides;
    44use OpenGuides::Test;
    5 use Test::More tests => 6;
     5use Test::More tests => 17; # 19 when all enabled
    66
    77eval { require DBD::SQLite; };
     
    99
    1010SKIP: {
    11     skip "DBD::SQLite not installed - no database to test with", 6
     11    skip "DBD::SQLite not installed - no database to test with", 17
    1212      unless $have_sqlite;
    1313
     
    3333                       { category => "Alpha" } )
    3434      or die "Couldn't write node";
     35
     36    # Test the normal, HTML version
    3537    my $output = eval {
    3638        $guide->show_index(
     
    4547    unlike( $output, qr|<title>\s*-|, "...sets <title> correctly" );
    4648
     49    # Test the RDF version
    4750    $output = $guide->show_index(
    4851                                  type          => "category",
     
    5356    like( $output, qr|Content-Type: application/rdf\+xml|,
    5457          "RDF output gets content-type of application/rdf+xml" );
     58    like( $output, qr|<rdf:RDF|, "Really is rdf" );
     59    like( $output, qr|<dc:title>Category Alpha</dc:title>|, "Right rdf title" );
     60    my @entries = ($output =~ /(\<rdf\:li\>)/g);
     61    is( 2, scalar @entries, "Right number of nodes included in rdf" );
     62
     63    # Test the RSS version
     64    $output = eval {
     65        $guide->show_index(
     66                            type          => "category",
     67                            value         => "Alpha",
     68                            return_output => 1,
     69                            format        => "rss",
     70                          );
     71    };
     72    is( $@, "", "->show_index doesn't die when asked for rss" );
     73    like( $output, qr|Content-Type: application/rdf\+xml|,
     74          "RSS output gets content-type of application/rdf+xml" );
     75    like( $output, "/\<rdf\:RDF.*?http\:\/\/purl.org\/rss\//s", "Really is rss" );
     76    #like( $output, qr|<title>Category Alpha</title>|, "Right rss title" );
     77    my @entries = ($output =~ /(\<\/item\>)/g);
     78    is( 2, scalar @entries, "Right number of nodes included in rss" );
     79warn($output);
     80
     81    # Test the Atom version
     82    $output = eval {
     83        $guide->show_index(
     84                            type          => "category",
     85                            value         => "Alpha",
     86                            return_output => 1,
     87                            format        => "atom",
     88                          );
     89    };
     90    is( $@, "", "->show_index doesn't die when asked for atom" );
     91    like( $output, qr|Content-Type: application/atom\+xml|,
     92          "Atom output gets content-type of application/atom+xml" );
     93    like( $output, qr|<feed|, "Really is atom" );
     94    #like( $output, qr|<title>Category Alpha</title>|, "Right atom title" );
     95    my @entries = ($output =~ /(\<entry\>)/g);
     96    is( 2, scalar @entries, "Right number of nodes included in atom" );
    5597}
Note: See TracChangeset for help on using the changeset viewer.