remove useless test
[catagits/Catalyst-Plugin-Session-State-Cookie.git] / t / live_app.t
index 633a36f..d2b4ef9 100644 (file)
@@ -1,8 +1,9 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 
+use FindBin qw/$Bin/;
+use lib "$Bin/lib";
+
 use Test::More;
 
 BEGIN {
@@ -14,38 +15,6 @@ BEGIN {
     plan 'no_plan';
 }
 
-{
-
-    package CookieTestApp;
-    use Catalyst qw/
-      Session
-      Session::Store::Dummy
-      Session::State::Cookie
-      /;
-
-    sub page : Local {
-        my ( $self, $c ) = @_;
-        $c->res->body( "Hi! hit number " . ++$c->session->{counter} );
-    }
-
-    sub stream : Local {
-        my ( $self, $c ) = @_;
-        my $count = ++$c->session->{counter};
-        $c->res->write("hit number ");
-        $c->res->write($count);
-    }
-
-    sub deleteme : Local {
-        my ( $self, $c ) = @_;
-        my $id = $c->get_session_id;
-        $c->delete_session;
-        my $id2 = $c->get_session_id;
-        $c->res->body( $id ne ( $id2 || '' ) );
-    }
-
-    __PACKAGE__->setup;
-}
-
 use Test::WWW::Mechanize::Catalyst qw/CookieTestApp/;
 
 my $m = Test::WWW::Mechanize::Catalyst->new;
@@ -85,3 +54,10 @@ cmp_ok( $expired, "<", $updated_expired, "streaming also extends cookie" );
 
 $m->get_ok( "http://localhost/deleteme", "get page" );
 $m->content_is( 1, 'session id changed' );
+
+$m->get_ok( "https://localhost/page", "get page over HTTPS - init session");
+$m->content_contains( "hit number 1", "first hit" );
+$m->get_ok( "http://localhost/page", "get page again over HTTP");
+$m->content_contains( "hit number 1", "first hit again - cookie not sent" );
+$m->get_ok( "https://localhost/page", "get page over HTTPS");
+$m->content_contains( "hit number 2", "second hit" );