[Catalyst-commits] r7653 - / trunk/examples/NewAuthApp/t
zarquon at dev.catalyst.perl.org
zarquon at dev.catalyst.perl.org
Wed Apr 30 11:42:29 BST 2008
Author: zarquon
Date: 2008-04-30 11:42:29 +0100 (Wed, 30 Apr 2008)
New Revision: 7653
Modified:
/
trunk/examples/NewAuthApp/t/controller_Admin.t
Log:
r12998 at zaphod: kd | 2008-04-30 13:09:41 +1000
admin tests
Property changes on:
___________________________________________________________________
Name: svk:merge
- 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:12997
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
+ 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:12998
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
Modified: trunk/examples/NewAuthApp/t/controller_Admin.t
===================================================================
--- trunk/examples/NewAuthApp/t/controller_Admin.t 2008-04-30 10:42:03 UTC (rev 7652)
+++ trunk/examples/NewAuthApp/t/controller_Admin.t 2008-04-30 10:42:29 UTC (rev 7653)
@@ -1,10 +1,32 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 11;
-BEGIN { use_ok 'Catalyst::Test', 'NewAuthApp' }
+BEGIN { use_ok 'Test::WWW::Mechanize::Catalyst', 'NewAuthApp' }
BEGIN { use_ok 'NewAuthApp::Controller::Admin' }
-ok( request('/admin')->is_success, 'Request should succeed' );
+my $mech=Test::WWW::Mechanize::Catalyst->new();
+$mech->get_ok('http://localhost/');
+$mech->submit_form( form_number => 1,
+ fields => {
+ user => 'bob',
+ password => 'bob',
+ },
+ );
+$mech->content_contains('Login successful', 'logged in');
+$mech->follow_link_ok( {text => 'this'}, 'got admin page');
+$mech->content_contains("you're allowed to admin",'allowed to admin');
+$mech->get_ok('http://localhost/auth/logout','logged out');
+$mech->get_ok('http://localhost/');
+$mech->submit_form( form_number => 1,
+ fields => {
+ user => 'bill',
+ password => 'bill',
+ },
+ );
+$mech->content_contains('Login successful', 'logged in');
+$mech->follow_link_ok( {text => 'this'}, 'got admin page');
+$mech->content_contains('You are not allowed to view this page','not allowed');
+
More information about the Catalyst-commits
mailing list