Skip to content

Commit

Permalink
Merge branch 'hotfix/test_port'
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Dec 11, 2011
2 parents 1e24575 + 955f177 commit 57cb015
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
33 changes: 17 additions & 16 deletions t/003_client.t
Expand Up @@ -17,6 +17,7 @@ require Test::WWW::Mechanize;
plan( skip_all => 'Unsupported OS' ) if not $run;

my $url = "http://localhost:$ENV{DWIMMER_PORT}";
my $URL = "$url/";

plan( tests => 55 );

Expand All @@ -34,7 +35,7 @@ my @links = map { $_->{filename} ? substr( $_->{filename}, 1 ) : '' } @pages;
my @exp_links = map { quotemeta($_) } @links;

my $w = Test::WWW::Mechanize->new;
$w->get_ok($url);
$w->get_ok($URL);
$w->content_like( qr{Welcome to your Dwimmer installation}, 'content ok' );
$w->get_ok("$url/other");
$w->content_like( qr{Page does not exist}, 'content of missing pages is ok' );
Expand All @@ -46,8 +47,8 @@ require XML::Simple;
test_rss(
{
'dc:creator' => 'admin',
'link' => 'http://localhost:3001/',
'rdf:about' => 'http://localhost:3001/',
'link' => $URL,
'rdf:about' => $URL,
'dc:subject' => 'Welcome to your Dwimmer installation',
'title' => 'Welcome to your Dwimmer installation',
'dc:date' => ignore(), #'2011-12-07T17:53:48+00:00',
Expand All @@ -57,12 +58,12 @@ test_rss(

test_sitemap(
{
'loc' => 'http://localhost:3001/'
'loc' => $URL
}
);

my $u = Test::WWW::Mechanize->new;
$u->get_ok($url);
$u->get_ok($URL);
$u->post_ok(
"$url/_dwimmer/login.json",
{ username => 'admin',
Expand Down Expand Up @@ -246,7 +247,7 @@ is_deeply(
'page data after save'
);

$w->get_ok($url);
$w->get_ok($URL);

$w->content_like(
qr{New text <a href="link">link</a> here and <a href="$exp_links[2]">$exp_links[2]</a> here},
Expand Down Expand Up @@ -401,7 +402,7 @@ is_deeply(
'cannot get user data afer logout'
);

my $guest = Dwimmer::Client->new( host => $url );
my $guest = Dwimmer::Client->new( host => $URL );
is_deeply(
$guest->list_users,
{ dwimmer_version => $Dwimmer::Client::VERSION,
Expand Down Expand Up @@ -438,26 +439,26 @@ is_deeply(
test_rss([
{
'dc:creator' => 'admin',
'link' => 'http://localhost:3001/space and.dot and $@% too',
'rdf:about' => 'http://localhost:3001/space and.dot and $@% too',
'link' => "$url/space and.dot and " . '$@% too',
'rdf:about' => "$url/space and.dot and " . '$@% too',
'dc:subject' => 'dotspace',
'title' => 'dotspace',
'dc:date' => ignore(),
'description' => 'File with space and dot'
},
{
'dc:creator' => 'admin',
'link' => 'http://localhost:3001/xyz',
'rdf:about' => 'http://localhost:3001/xyz',
'link' => "$url/xyz",
'rdf:about' => "$url/xyz",
'dc:subject' => 'New title of xyz',
'title' => 'New title of xyz',
'dc:date' => ignore(),
'description' => 'New text'
},
{
'dc:creator' => 'admin',
'link' => 'http://localhost:3001/',
'rdf:about' => 'http://localhost:3001/',
'link' => $URL,
'rdf:about' => $URL,
'dc:subject' => 'New main title',
'title' => 'New main title',
'dc:date' => ignore(),
Expand All @@ -466,13 +467,13 @@ test_rss([
]);
test_sitemap([
{
'loc' => 'http://localhost:3001/'
'loc' => $URL
},
{
'loc' => 'http://localhost:3001/xyz'
'loc' => "$url/xyz"
},
{
'loc' => 'http://localhost:3001/space and.dot and $@% too'
'loc' => "$url/space and.dot and " . '$@% too'
}
]);

Expand Down
2 changes: 1 addition & 1 deletion t/010_subscribe.t
Expand Up @@ -305,7 +305,7 @@ sub _check_validate_mail {
my $link = '';
my $found_code = '';
if ( $VAR1->{Data}
=~ s{(http://localhost:3001/_dwimmer/validate_email\?listid=1&email=$email\@dwimmer\.org&code=(\w+))}{<% url %>}
=~ s{(http://localhost:$ENV{DWIMMER_PORT}/_dwimmer/validate_email\?listid=1&email=$email\@dwimmer\.org&code=(\w+))}{<% url %>}
)
{
( $link, $found_code ) = ( $1, $2 );
Expand Down
4 changes: 3 additions & 1 deletion t/lib/Dwimmer/Test.pm
Expand Up @@ -8,6 +8,7 @@ our @EXPORT = qw(start stop $admin_mail @users read_file);

#use File::Basename qw(dirname);

use File::Basename qw(basename);
use File::Spec;
use File::Temp qw(tempdir);
use File::Copy qw(copy);
Expand All @@ -21,9 +22,10 @@ sub start {
my $dir = tempdir( CLEANUP => 1 );

# print STDERR "# $dir\n";
my ($cnt) = split /_/, basename $0;

$ENV{DWIMMER_TEST} = 1;
$ENV{DWIMMER_PORT} = 3001;
$ENV{DWIMMER_PORT} = 3000+$cnt;
$ENV{DWIMMER_MAIL} = File::Spec->catfile( $dir, 'mail.txt' );

our $admin_mail = 'test@dwimmer.org';
Expand Down

0 comments on commit 57cb015

Please sign in to comment.