Permalink
Browse files

Merge branch 'hotfix/test_port'

  • Loading branch information...
2 parents 1e24575 + 955f177 commit 57cb0159fb4c34c89e62e5653ca055d4d7a303be @szabgab committed Dec 11, 2011
Showing with 21 additions and 18 deletions.
  1. +17 −16 t/003_client.t
  2. +1 −1 t/010_subscribe.t
  3. +3 −1 t/lib/Dwimmer/Test.pm
View
@@ -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 );
@@ -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' );
@@ -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',
@@ -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',
@@ -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},
@@ -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,
@@ -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(),
@@ -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'
}
]);
View
@@ -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 );
View
@@ -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);
@@ -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';

0 comments on commit 57cb015

Please sign in to comment.