aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-04-01 15:20:23 +0100
committerEdmund von der Burg <evdb@mysociety.org>2011-04-01 15:20:23 +0100
commit48fac6844f4a55c2086e17e9c75819a8ebc8c156 (patch)
treef496cc2666e4353b89d433744b5c9cb72915076e /t/app/controller
parentbd0ceef9ca66e1fc2a2e88d37165fe85eec3fe3e (diff)
Prevent access to '/my' for users who are not logged in
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/my.t19
1 files changed, 14 insertions, 5 deletions
diff --git a/t/app/controller/my.t b/t/app/controller/my.t
index e018a8941..1ed6806a4 100644
--- a/t/app/controller/my.t
+++ b/t/app/controller/my.t
@@ -1,10 +1,19 @@
use strict;
use warnings;
-use Test::More;
+use Test::More tests => 11;
-use Catalyst::Test 'FixMyStreet::App';
-use FixMyStreet::App::Controller::My;
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+$mech->get_ok('/my');
+is $mech->uri->path, '/auth', "got sent to the login page";
+
+# login
+my $user = $mech->log_in_ok( 'test@example.com' );
+$mech->get_ok('/my');
+is $mech->uri->path, '/my', "stayed on '/my/' page";
+
+# cleanup
+$mech->delete_user( $user );
-ok( request('/my')->is_success, 'Request should succeed' );
-done_testing();