aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-05-14 17:11:51 +0100
committerStruan Donald <struan@exo.org.uk>2012-05-14 17:11:51 +0100
commitdd16641400e49f94f480db8c3e62e0760065e6d8 (patch)
tree45daa69ef28228ed4e043b7ac46bd91253a2c6c1 /t/app/controller
parent220769568acb6efb42661dd27bcb1a5260c321c6 (diff)
basic dashbaord tests
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/dashboard.t42
1 files changed, 42 insertions, 0 deletions
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t
new file mode 100644
index 000000000..b96196d21
--- /dev/null
+++ b/t/app/controller/dashboard.t
@@ -0,0 +1,42 @@
+use strict;
+use warnings;
+use Test::More;
+
+use FixMyStreet::TestMech;
+
+my $mech = FixMyStreet::TestMech->new;
+
+my $test_user = 'council_user@example.com';
+my $test_pass = 'password';
+my $test_council = 2651;
+
+$mech->delete_user( $test_user );
+my $user = FixMyStreet::App->model('DB::User')->create( {
+ email => $test_user,
+ password => $test_pass,
+} );
+
+$mech->not_logged_in_ok;
+$mech->get_ok('/dashboard');
+
+$mech->content_contains( 'sign in' );
+
+$mech->submit_form(
+ with_fields => { email => $test_user, password_sign_in => $test_pass }
+);
+
+is $mech->status, '404', 'If not council user get 404';
+
+$user->from_council( $test_council );
+$user->update;
+
+$mech->log_out_ok;
+$mech->get_ok('/dashboard');
+$mech->submit_form_ok( {
+ with_fields => { email => $test_user, password_sign_in => $test_pass }
+} );
+
+$mech->content_contains( 'Summary Statistics' );
+$mech->content_contains( 'Edinburgh' );
+
+done_testing;