source: trunk/t/62_bug_os_coords.t @ 559

Last change on this file since 559 was 559, checked in by kake, 17 years ago

Huge-ass pile of changes to make geo stuff work worldwide.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1use CGI::Wiki::Setup::SQLite;
2use Config::Tiny;
3use Cwd;
4use OpenGuides::Template;
5use OpenGuides::Utils;
6use Test::More tests => 2;
7
8eval { require DBD::SQLite; };
9my $have_sqlite = $@ ? 0 : 1;
10
11SKIP: {
12    skip "DBD::SQLite not installed - no database to test with", 2
13      unless $have_sqlite;
14
15    CGI::Wiki::Setup::SQLite::setup( { dbname => "t/node.db" } );
16    my $config = Config::Tiny->new;
17    $config->{_} = {
18                     dbtype             => "sqlite",
19                     dbname             => "t/node.db",
20                     indexing_directory => "t/indexes",
21                     script_url         => "http://example.com/",
22                     script_name        => "wiki.cgi",
23                     site_name          => "Test Site",
24                     template_path      => cwd . "/templates",
25                     geo_handler        => 1,
26                   };
27
28    my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
29
30    my $q = CGI->new;
31    $q->param( -name => "os_x", -value => "123456 " );
32    $q->param( -name => "os_y", -value => "654321 " );
33    $q->param( -name => "categories", -value => "" ); #avoid uninit val warning
34    $q->param( -name => "locales", -value => "" );    #avoid uninit val warning
35
36    my %metadata_vars = OpenGuides::Template->extract_metadata_vars(
37        wiki    => $wiki,
38        config  => $config,
39        cgi_obj => $q,
40    );
41
42    is( $metadata_vars{os_x}, "123456", "trailing space stripped from os_x" );
43    is( $metadata_vars{os_y}, "654321", "trailing space stripped from os_y" );
44}
Note: See TracBrowser for help on using the repository browser.