Changeset 1273


Ignore:
Timestamp:
Sep 4, 2009, 11:24:51 PM (12 years ago)
Author:
Dominic Hargreaves
Message:

test cleanups for refreshing the test db (thanks bob) (fixes #271)

Location:
trunk
Files:
69 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r1272 r1273  
    99        Return HTTP 404 status when displaying a node that doens't exist (#102)
    1010        Add Recent Changes tests (refers to #270)
     11        Some test cleanups (#271)
    1112
    12130.64    23 February 2009
  • trunk/lib/OpenGuides/Test.pm

    r1261 r1273  
    22
    33use OpenGuides::Config;
     4use Wiki::Toolkit::Setup::SQLite;
    45
    56use strict;
     
    2425  use OpenGuides;
    2526  use OpenGuides::Test;
     27
     28  OpenGuides::Test::refresh_db();
    2629
    2730  my $config = OpenGuides::Test->make_basic_config;
     
    202205}
    203206
     207=item B<refresh_db>
     208
     209  Openguides::Test::refresh_db();
     210
     211Unlink the existing SQLite database t/node.db and plucene indexes. Then create a new SQLite database t/node.db
     212
     213=cut
     214sub refresh_db {
     215    unlink "t/node.db";
     216    unlink <t/indexes/*>;
     217    Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     218}
     219
     220
    204221=back
    205222
  • trunk/t/01_load.t

    r786 r1273  
     1use strict;
    12use Test::More tests => 8;
    23
  • trunk/t/11_utils.t

    r1066 r1273  
    33use OpenGuides::Config;
    44use OpenGuides::Utils;
     5use OpenGuides::Test;
    56use Test::More tests => 10;
    67
     
    3435
    3536    # Clear out the database from any previous runs.
    36     unlink "t/node.db";
    37     unlink <t/indexes/*>;
    38     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     37    OpenGuides::Test::refresh_db();
     38
    3939
    4040    my $config = OpenGuides::Config->new(
  • trunk/t/12_macros.t

    r1027 r1273  
    1616SKIP: {
    1717    # Clear out the database from any previous runs.
    18     unlink "t/node.db";
    19     unlink <t/indexes/*>;
    20     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     18    OpenGuides::Test::refresh_db();
    2119
    2220    my $config = OpenGuides::Test->make_basic_config;
  • trunk/t/14_recent_changes_cookies.t

    r958 r1273  
    44use OpenGuides;
    55use OpenGuides::CGI;
     6use OpenGuides::Test;
    67use Time::Piece;
    78use Time::Seconds;
     
    6364    skip "DBD::SQLite could not be used - no database to test with. ($sqlite_error)", 2
    6465      unless $have_sqlite;
     66    OpenGuides::Test::refresh_db();
    6567
    66     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     68
    6769    my $config = OpenGuides::Config->new(
    6870           vars => {
  • trunk/t/16_test_tester.t

    r956 r1273  
    1818plan tests => 2;
    1919
     20
    2021# Clear out the database from any previous runs.
    21 unlink "t/node.db";
    22 unlink <t/indexes/*>;
     22    OpenGuides::Test::refresh_db();
    2323
    24 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2524my $config = OpenGuides::Test->make_basic_config;
    2625$config->site_name( "Test Site" );
  • trunk/t/17_commit_node.t

    r1077 r1273  
    2323
    2424# Clear out the database from any previous runs.
    25 unlink "t/node.db";
    26 unlink <t/indexes/*>;
     25    OpenGuides::Test::refresh_db();
    2726
    28 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2927my $config = OpenGuides::Config->new(
    3028       vars => {
  • trunk/t/19_autocreate.t

    r956 r1273  
    1919
    2020# Clear out the database from any previous runs.
    21 foreach my $del_node ( $wiki->list_all_nodes ) {
    22     print "# Deleting node $del_node\n";
    23     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    24 }
     21    OpenGuides::Test::refresh_db();
    2522
    2623# Write a custom template to autofill content in autocreated nodes.
  • trunk/t/20_edit_form.t

    r1031 r1273  
    1919
    2020# Clear out the database from any previous runs.
    21 unlink "t/node.db";
    22 unlink <t/indexes/*>;
    23 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     21    OpenGuides::Test::refresh_db();
    2422
    2523my $config = OpenGuides::Test->make_basic_config;
  • trunk/t/21_rdf.t

    r1232 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides;
     
    1819plan tests => 30;
    1920
    20 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     21# clear out the database   
     22OpenGuides::Test::refresh_db();
     23
     24
    2125my $config = OpenGuides::Test->make_basic_config;
    2226$config->script_url( "http://wiki.example.com/" );
     
    3438my $wiki = $guide->wiki;
    3539
    36 # Clear out the database from any previous runs.
    37 foreach my $del_node ( $wiki->list_all_nodes ) {
    38     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    39 }
    4040
    4141my $rdf_writer = eval {
  • trunk/t/22_feed_recent_changes.t

    r1026 r1273  
    2828foreach my $feed_type (@feed_types) {
    2929    # Clear out the database from any previous runs.
    30     unlink "t/node.db";
    31     unlink <t/indexes/*>;
     30    OpenGuides::Test::refresh_db();
    3231
    33     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    3432    my $config = OpenGuides::Test->make_basic_config;
    3533    $config->script_name( "wiki.cgi" );
  • trunk/t/23_feed_node_all_versions.t

    r956 r1273  
    55use OpenGuides::Feed;
    66use OpenGuides::Utils;
     7use OpenGuides::Test;
    78use Test::More;
    89
     
    2627foreach my $feed_type (@feed_types) {
    2728    # Clear out the database from any previous runs.
    28     unlink "t/node.db";
    29     unlink <t/indexes/*>;
     29    OpenGuides::Test::refresh_db();
    3030
    31     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    3231    my $config = OpenGuides::Config->new(
    3332           vars => {
  • trunk/t/24_feed_node_listings.t

    r956 r1273  
    55use OpenGuides::Feed;
    66use OpenGuides::Utils;
     7use OpenGuides::Test;
    78use Test::More;
    89
     
    2627foreach my $feed_type (@feed_types) {
    2728    # Clear out the database from any previous runs.
    28     unlink "t/node.db";
    29     unlink <t/indexes/*>;
     29    OpenGuides::Test::refresh_db();
    3030
    31     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    3231    my $config = OpenGuides::Config->new(
    3332           vars => {
  • trunk/t/25_write_geo_data.t

    r956 r1273  
    3434
    3535# Clear out the database from any previous runs.
    36 unlink "t/node.db";
    37 unlink <t/indexes/*>;
     36    OpenGuides::Test::refresh_db();
    3837
    39 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    4038my $config = OpenGuides::Config->new(
    4139       vars => {
  • trunk/t/26_geo_data_search_form.t

    r956 r1273  
    3838
    3939# Clear out the database from any previous runs.
    40 unlink "t/node.db";
    41 unlink <t/indexes/*>;
     40    OpenGuides::Test::refresh_db();
    4241
    43 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    4442my $config = OpenGuides::Test->make_basic_config;
    4543$config->use_plucene( 1 );
  • trunk/t/27_geo_data_edit_form.t

    r1235 r1273  
    3838
    3939# Clear out the database from any previous runs.
    40 unlink "t/node.db";
    41 unlink <t/indexes/*>;
     40    OpenGuides::Test::refresh_db();
    4241
    43 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    4442my $config = OpenGuides::Test->make_basic_config;
    4543$config->use_plucene( 1 );
  • trunk/t/28_wgs84_coords.t

    r1089 r1273  
    1515
    1616# Clear out the database from any previous runs.
    17 unlink "t/node.db";
    18 # And give us a new one
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     17
     18    OpenGuides::Test::refresh_db();
    2019
    2120# Now we can start testing
  • trunk/t/30_search_raw.t

    r1024 r1273  
    1414
    1515# Clear out the database from any previous runs.
    16 unlink "t/node.db";
    17 unlink <t/indexes/*>;
     16    OpenGuides::Test::refresh_db();
    1817
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2018my $config = OpenGuides::Test->make_basic_config;
    2119my $guide = OpenGuides->new( config => $config );
  • trunk/t/31_search.t

    r956 r1273  
    1414
    1515# Clear out the database from any previous runs.
    16 unlink "t/node.db";
    17 unlink <t/indexes/*>;
     16    OpenGuides::Test::refresh_db();
    1817
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2018my $config = OpenGuides::Test->make_basic_config;
    2119$config->script_name( "wiki.cgi" );
  • trunk/t/32_search_simple_metadata.t

    r956 r1273  
    33use OpenGuides::Config;
    44use OpenGuides::Search;
     5use OpenGuides::Test;
    56use Test::More;
    67
     
    1516
    1617# Clear out the database from any previous runs.
    17 unlink "t/node.db";
    18 unlink <t/indexes/*>;
     18    OpenGuides::Test::refresh_db();
    1919
    20 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2120my $config = OpenGuides::Config->new(
    2221       vars => {
  • trunk/t/33_search_advanced_search.t

    r956 r1273  
    2626
    2727# Clear out the database from any previous runs.
    28 unlink "t/node.db";
    29 unlink <t/indexes/*>;
    30 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     28
     29    OpenGuides::Test::refresh_db();
    3130
    3231my $config = OpenGuides::Config->new(
  • trunk/t/33_search_advanced_search_utm.t

    r956 r1273  
    2525
    2626# Clear out the database from any previous runs.
    27 unlink "t/node.db";
    28 unlink <t/indexes/*>;
    29 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     27
     28    OpenGuides::Test::refresh_db();
    3029
    3130my $config = OpenGuides::Config->new(
  • trunk/t/34_search_paging.t

    r1255 r1273  
    2020
    2121# Clear out the database from any previous runs.
    22 unlink "t/node.db";
    23 unlink <t/indexes/*>;
    24 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     22    OpenGuides::Test::refresh_db();
     23
    2524
    2625my $config = OpenGuides::Test->make_basic_config;
  • trunk/t/35_search_two_searches.t

    r956 r1273  
    33use OpenGuides::Config;
    44use OpenGuides::Search;
     5use OpenGuides::Test;
    56use Test::More;
    67
     
    3334
    3435# Clear out the database from any previous runs.
    35 unlink "t/node.db";
    36 unlink <t/indexes/*>;
     36    OpenGuides::Test::refresh_db();
    3737
    38 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    3938my $config = OpenGuides::Config->new(
    4039       vars => {
  • trunk/t/36_search_order.t

    r956 r1273  
    33use OpenGuides::Config;
    44use OpenGuides::Search;
     5use OpenGuides::Test;
    56use Test::More;
    67
     
    1920
    2021# Clear out the database from any previous runs.
    21 unlink "t/node.db";
    22 unlink <t/indexes/*>;
     22    OpenGuides::Test::refresh_db();
    2323
    24 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2524my $config = OpenGuides::Config->new(
    2625       vars => {
  • trunk/t/37_search_summaries.t

    r956 r1273  
    33use OpenGuides::Config;
    44use OpenGuides::Search;
     5use OpenGuides::Test;
    56use Test::More;
    67
     
    1415
    1516# Clear out the database from any previous runs.
    16 unlink "t/node.db";
    17 unlink <t/indexes/*>;
     17    OpenGuides::Test::refresh_db();
    1818
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2019my $config = OpenGuides::Config->new(
    2120       vars => {
  • trunk/t/38_search_params.t

    r956 r1273  
    44use OpenGuides::Config;
    55use OpenGuides::Search;
     6use OpenGuides::Test;
    67use Test::More;
    78
     
    3334
    3435# Clear out the database from any previous runs.
    35 unlink "t/node.db";
    36 unlink <t/indexes/*>;
     36    OpenGuides::Test::refresh_db();
    3737
    38 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    3938my $config = OpenGuides::Config->new(
    4039       vars => {
  • trunk/t/39_search_form.t

    r956 r1273  
    3838
    3939# Clear out the database from any previous runs.
    40 unlink "t/node.db";
    41 unlink <t/indexes/*>;
     40    OpenGuides::Test::refresh_db();
    4241
    43 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    4442my $config = OpenGuides::Test->make_basic_config;
    4543$config->use_plucene( 1 );
  • trunk/t/40_search_as_feed.t

    r956 r1273  
    1414
    1515# Clear out the database from any previous runs.
    16 unlink "t/node.db";
    17 unlink <t/indexes/*>;
     16    OpenGuides::Test::refresh_db();
    1817
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2018my $config = OpenGuides::Test->make_basic_config;
    2119$config->script_name( "wiki.cgi" );
  • trunk/t/42_edit_conflict.t

    r956 r1273  
    1717
    1818plan tests => 16;
    19 
    20 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     19# clear out database
     20    OpenGuides::Test::refresh_db();
    2121
    2222# Make a guide that works on latitude/longitude, and allows node images.
     
    2828my $wiki = $guide->wiki;
    2929
    30 # Clear out the database from any previous runs.
    31 foreach my $del_node ( $wiki->list_all_nodes ) {
    32     print "# Deleting node $del_node\n";
    33     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    34 }
    3530
    3631
  • trunk/t/43_preview_edits.t

    r956 r1273  
    1919
    2020# Clear out the database from any previous runs.
    21 unlink "t/node.db";
    22 unlink <t/indexes/*>;
    23 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     21    OpenGuides::Test::refresh_db();
    2422
    2523my $config = OpenGuides::Test->make_basic_config;
  • trunk/t/44_node_image.t

    r996 r1273  
    2121
    2222# Clear out the database from any previous runs.
    23 unlink "t/node.db";
    24 unlink <t/indexes/*>;
    25 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     23    OpenGuides::Test::refresh_db();
    2624
    2725# Make sure node image fields don't show up in edit form if config says
  • trunk/t/45_home_recent_changes.t

    r1141 r1273  
    1616
    1717# Clear out the database from any previous runs.
    18 unlink "t/node.db";
    19 unlink <t/indexes/*>;
    20 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     18    OpenGuides::Test::refresh_db();
    2119
    2220# Write some data to show up in recent changes.
  • trunk/t/46_map_in_node_display.t

    r953 r1273  
    2222
    2323# Clear out the database from any previous runs.
    24 unlink "t/node.db";
    25 unlink <t/indexes/*>;
    26 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     24    OpenGuides::Test::refresh_db();
    2725
    2826# Make a guide.
  • trunk/t/47_navbar_placement.t

    r969 r1273  
    2525
    2626# Clear out the database from any previous runs.
    27 unlink "t/node.db";
    28 unlink <t/indexes/*>;
    29 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     27    OpenGuides::Test::refresh_db();
    3028
    3129# Make a guide.
  • trunk/t/48_google_analytics.t

    r1204 r1273  
    1616
    1717# Clear out the database from any previous runs.
    18 unlink "t/node.db";
    19 unlink <t/indexes/*>;
    20 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     18    OpenGuides::Test::refresh_db();
    2119
    2220# Make a guide.
  • trunk/t/49_custom_header.t

    r1005 r1273  
    2525
    2626# Clear out the database from any previous runs.
    27 foreach my $del_node ( $wiki->list_all_nodes ) {
    28     print "# Deleting node $del_node\n";
    29     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    30 }
     27    OpenGuides::Test::refresh_db();
    3128
    3229# Make sure the tmp directory exists
  • trunk/t/51_display_node.t

    r1271 r1273  
    1616plan tests => 19;
    1717
    18 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } );
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     18    OpenGuides::Test::refresh_db();
     19
    2020my $config = OpenGuides::Config->new(
    2121       vars => {
  • trunk/t/52_display_diffs.t

    r956 r1273  
    1414plan tests => 5;
    1515
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16# Clear out the database from any previous runs.
     17    OpenGuides::Test::refresh_db();
     18
    1719my $config = OpenGuides::Test->make_basic_config;
    1820my $guide = OpenGuides->new( config => $config );
    1921my $wiki = $guide->wiki;
    2022
    21 # Clear out the database from any previous runs.
    22 foreach my $del_node ( $wiki->list_all_nodes ) {
    23     print "# Deleting node $del_node\n";
    24     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    25 }
    2623
    2724$wiki->write_node( "I Like Pie", "Best pie is meat pie." )
  • trunk/t/53_show_index.t

    r956 r1273  
    1414plan tests => 23; # 25 when all enabled
    1515
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16# Clear out the database from any previous runs.
     17    OpenGuides::Test::refresh_db();
     18
    1719my $config = OpenGuides::Test->make_basic_config;
    1820$config->script_name( "wiki.cgi" );
     
    2325isa_ok( $wiki, "Wiki::Toolkit" );
    2426
    25 # Clear out the database from any previous runs.
    26 foreach my $del_node ( $wiki->list_all_nodes ) {
    27     print "# Deleting node $del_node\n";
    28     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    29 }
    3027
    3128$wiki->write_node( "Test Page", "foo", undef,
  • trunk/t/54_redirect.t

    r1064 r1273  
    33use OpenGuides::Config;
    44use OpenGuides;
     5use OpenGuides::Test;
    56use Test::More;
    67
     
    1415plan tests => 2;
    1516
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    1717my $config = OpenGuides::Config->new(
    1818       vars => {
     
    2929if ( $@ ) { $config->use_plucene ( 0 ) };
    3030       
     31    OpenGuides::Test::refresh_db();
     32
    3133my $guide = OpenGuides->new( config => $config );
    3234my $wiki = $guide->wiki;
    3335
    34 # Clear out the database from any previous runs.
    35 foreach my $del_node ( $wiki->list_all_nodes ) {
    36     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    37 }
    3836
    3937$wiki->write_node( "Test Page", "#REDIRECT [[Test Page 2]]" )
  • trunk/t/55_node_history.t

    r956 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides;
     
    1314plan tests => 2;
    1415
    15 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } );
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16    OpenGuides::Test::refresh_db();
     17
    1718my $config = OpenGuides::Test->make_basic_config;
    1819$config->script_name( "mywiki.cgi" );
  • trunk/t/56_diffs_with_macros.t

    r956 r1273  
    1515
    1616# Clear out the database from any previous runs.
    17 unlink "t/node.db";
    18 unlink <t/indexes/*>;
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     17    OpenGuides::Test::refresh_db();
    2018
    2119my $config = OpenGuides::Test->make_basic_config;
  • trunk/t/57_random_page.t

    r1027 r1273  
    1616
    1717# Clear out database from previous runs, set up a guide.
    18 refresh_db();
     18    OpenGuides::Test::refresh_db();
     19
    1920$config = OpenGuides::Test->make_basic_config;
    2021$config->script_url( "http://www.example.com/" );
     
    4546
    4647# Clear the database and write some data including categories and locales.
    47 refresh_db();
     48    OpenGuides::Test::refresh_db();
     49
    4850$config = OpenGuides::Test->make_basic_config;
    4951$config->script_url( "http://www.example.com/" );
     
    8890
    8991# Now make sure we can pick things up from specific categories/locales if asked
    90 refresh_db();
     92    OpenGuides::Test::refresh_db();
     93
    9194$config = OpenGuides::Test->make_basic_config;
    9295$guide = OpenGuides->new( config => $config );
     
    144147       "don't get a redirect if we ask for category/locale with no pages in" );
    145148
    146 sub refresh_db {
    147     unlink "t/node.db";
    148     unlink <t/indexes/*>;
    149     Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    150 }
    151149
    152150sub get_node_from_output {
  • trunk/t/58_navbar_common_locales_categories.t

    r1091 r1273  
    5151
    5252# Clear out the database from any previous runs.
    53 unlink "t/node.db";
    54 unlink <t/indexes/*>;
    55 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     53    OpenGuides::Test::refresh_db();
    5654
    5755while (my ($page, $get_content) = each %pages) {
  • trunk/t/59_preferences.t

    r1091 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides;
     
    2526plan tests => 2;
    2627
    27 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/prefs.db" } );
    28 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/prefs.db" } );
     28    OpenGuides::Test::refresh_db();
     29
    2930my $config = OpenGuides::Test->make_basic_config;
    3031my $guide = OpenGuides->new( config => $config );
  • trunk/t/61_bug_textareas.t

    r956 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides::Template;
     
    1415plan tests => 1;
    1516
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     17    OpenGuides::Test::refresh_db();
     18
    1719my $config = OpenGuides::Test->make_basic_config;
    1820my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
  • trunk/t/62_bug_trailing_whitespace.t

    r956 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides::Config;
     
    1617
    1718# Clear out the database from any previous runs.
    18 unlink "t/node.db";
    19 unlink <t/indexes/*>;
    20 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     19    OpenGuides::Test::refresh_db();
    2120
    2221my $config = OpenGuides::Test->make_basic_config;
  • trunk/t/63_bug_map_link_no_address.t

    r956 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides;
     
    1314plan tests => 1;
    1415
    15 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } );
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16    OpenGuides::Test::refresh_db();
     17
    1718my $config = OpenGuides::Test->make_basic_config;
    1819my $guide = OpenGuides->new( config => $config );
  • trunk/t/64_bug_node_history.t

    r956 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides::Config;
    34use Cwd;
    45use OpenGuides;
     6use OpenGuides::Test;
    57use Test::More;
    68
     
    1416plan tests => 1;
    1517
    16 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } );
    17 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     18    OpenGuides::Test::refresh_db();
     19
    1820my $config = OpenGuides::Config->new(
    1921       vars => {
  • trunk/t/65_bug_metadata_escape.t

    r956 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides::Config;
    34use Cwd;
    45use OpenGuides;
     6use OpenGuides::Test;
    57use Test::More;
    68
     
    1315plan tests => 1;
    1416
    15 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } );
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     17    OpenGuides::Test::refresh_db();
     18
    1719my $config = OpenGuides::Config->new(
    1820       vars => {
  • trunk/t/66_bug_latlong_representation.t

    r956 r1273  
    2222
    2323# Clear out the database from any previous runs.
    24 unlink "t/node.db";
    25 unlink <t/indexes/*>;
     24    OpenGuides::Test::refresh_db();
    2625
    27 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    2826my $config = OpenGuides::Config->new(
    2927       vars => {
  • trunk/t/67_bug_first_version.t

    r956 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides::Config;
     
    1516
    1617# Clear out the database from any previous runs.
    17 unlink "t/node.db";
    18 unlink <t/indexes/*>;
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     18    OpenGuides::Test::refresh_db();
     19
    2020
    2121my $config = OpenGuides::Test->make_basic_config;
  • trunk/t/68_bug_website_displayed.t

    r1231 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides;
     
    1314plan tests => 2;
    1415
    15 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } );
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16    OpenGuides::Test::refresh_db();
     17
    1718my $config = OpenGuides::Test->make_basic_config;
    1819my $guide = OpenGuides->new( config => $config );
  • trunk/t/69_bug_zero_geo.t

    r1104 r1273  
     1use strict;
    12use Wiki::Toolkit::Setup::SQLite;
    23use OpenGuides::Config;
     
    1415plan tests => 6;
    1516
    16 Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } );
    17 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     17    OpenGuides::Test::refresh_db();
     18
    1819my $config = OpenGuides::Config->new(
    1920       vars => {
  • trunk/t/70_admin_home.t

    r1062 r1273  
    1313plan tests => 12;
    1414
    15 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     15    OpenGuides::Test::refresh_db();
     16
    1617my $config = OpenGuides::Test->make_basic_config;
    1718$config->script_name( "wiki.cgi" );
     
    2223isa_ok( $wiki, "Wiki::Toolkit" );
    2324
    24 # Clear out the database from any previous runs.
    25 foreach my $del_node ( $wiki->list_all_nodes ) {
    26     print "# Deleting node $del_node\n";
    27     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    28 }
    2925
    3026
  • trunk/t/71_missing_metadata.t

    r956 r1273  
    1313
    1414plan tests => 26;
     15    OpenGuides::Test::refresh_db();
    1516
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
    1717my $config = OpenGuides::Test->make_basic_config;
    1818$config->script_name( "wiki.cgi" );
     
    2323isa_ok( $wiki, "Wiki::Toolkit" );
    2424
    25 # Clear out the database from any previous runs.
    26 foreach my $del_node ( $wiki->list_all_nodes ) {
    27     print "# Deleting node $del_node\n";
    28     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    29 }
    3025
    3126
  • trunk/t/72_node_moderation.t

    r956 r1273  
    1414plan tests => 19;
    1515
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16    OpenGuides::Test::refresh_db();
     17
    1718my $config = OpenGuides::Test->make_basic_config;
    1819$config->script_name( "wiki.cgi" );
     
    2324isa_ok( $wiki, "Wiki::Toolkit" );
    2425
    25 # Clear out the database from any previous runs.
    26 foreach my $del_node ( $wiki->list_all_nodes ) {
    27     print "# Deleting node $del_node\n";
    28     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    29 }
    3026
    3127
  • trunk/t/73_toggle_moderation.t

    r956 r1273  
    1414plan tests => 14;
    1515
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16    OpenGuides::Test::refresh_db();
     17
    1718my $config = OpenGuides::Test->make_basic_config;
    1819$config->script_name( "wiki.cgi" );
     
    2324isa_ok( $wiki, "Wiki::Toolkit" );
    2425
    25 # Clear out the database from any previous runs.
    26 foreach my $del_node ( $wiki->list_all_nodes ) {
    27     print "# Deleting node $del_node\n";
    28     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    29 }
    3026
    3127
  • trunk/t/74_ping_plugin.t

    r1033 r1273  
    1616my $have_ping = $@ ? 0 : 1;
    1717
    18 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     18    OpenGuides::Test::refresh_db();
     19
    1920my $config = OpenGuides::Config->new(
    2021    vars => {
  • trunk/t/75_revert_user.t

    r997 r1273  
    1414plan tests => 23;
    1515
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16    OpenGuides::Test::refresh_db();
     17
    1718my $config = OpenGuides::Test->make_basic_config;
    1819$config->script_name( "wiki.cgi" );
     
    2324isa_ok( $wiki, "Wiki::Toolkit" );
    2425
    25 # Clear out the database from any previous runs.
    26 foreach my $del_node ( $wiki->list_all_nodes ) {
    27     print "# Deleting node $del_node\n";
    28     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    29 }
    3026
    3127my %details;
  • trunk/t/76_detect_spam.t

    r1037 r1273  
    1515
    1616# Clear out the database from any previous runs.
    17 unlink "t/node.db";
    18 unlink <t/indexes/*>;
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     17    OpenGuides::Test::refresh_db();
    2018
    2119# Set up a guide which uses a spam detector module.
  • trunk/t/79_host_blacklist.t

    r1117 r1273  
    1515
    1616# Clear out the database from any previous runs.
    17 unlink "t/node.db";
    18 unlink <t/indexes/*>;
    19 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     17    OpenGuides::Test::refresh_db();
    2018
    2119# Set up a guide which uses a spam detector module.
  • trunk/t/81_node_moderate_whitelist.t

    r1240 r1273  
    1414plan tests => 12;
    1515
    16 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     16    OpenGuides::Test::refresh_db();
     17
    1718my $config = OpenGuides::Test->make_basic_config;
    1819$config->script_name( "wiki.cgi" );
     
    2425isa_ok( $wiki, "Wiki::Toolkit" );
    2526
    26 # Clear out the database from any previous runs.
    27 foreach my $del_node ( $wiki->list_all_nodes ) {
    28     print "# Deleting node $del_node\n";
    29     $wiki->delete_node( $del_node ) or die "Can't delete $del_node";
    30 }
    3127
    3228
  • trunk/t/83_show_delete_to_admins_only.t

    r1243 r1273  
    5050
    5151# Clear out the database from any previous runs.
    52 unlink "t/node.db";
    53 unlink <t/indexes/*>;
    54 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     52    OpenGuides::Test::refresh_db();
    5553
    5654
  • trunk/t/84_navbar_admin.t

    r1243 r1273  
    5050
    5151# Clear out the database from any previous runs.
    52 unlink "t/node.db";
    53 unlink <t/indexes/*>;
    54 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     52    OpenGuides::Test::refresh_db();
    5553
    5654
  • trunk/t/85_universal_edit_link.t

    r1178 r1273  
    1818
    1919# Clear out the database from any previous runs.
    20 unlink "t/node.db";
    21 unlink <t/indexes/*>;
    22 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     20    OpenGuides::Test::refresh_db();
    2321
    2422# Make a guide.
  • trunk/t/86_recent_changes.t

    r1272 r1273  
    2424plan tests => 10;
    2525
    26 # Clear out the database from any previous runs.
    27 unlink "t/node.db";
    28 unlink <t/indexes/*>;
     26OpenGuides::Test::refresh_db();
    2927
    30 Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     28
    3129my $config = OpenGuides::Config->new(
    3230       vars => {
     
    139137
    140138# set show_minor_edits to 0.
    141 my $cookie = OpenGuides::CGI->make_prefs_cookie(
     139 $cookie = OpenGuides::CGI->make_prefs_cookie(
    142140    config                     => $config,
    143141    username                   => "bob",
Note: See TracChangeset for help on using the changeset viewer.