diff options
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/auth_social.t | 3 | ||||
-rw-r--r-- | t/app/controller/photo.t | 4 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 4 | ||||
-rw-r--r-- | t/app/controller/reports.t | 5 |
4 files changed, 12 insertions, 4 deletions
diff --git a/t/app/controller/auth_social.t b/t/app/controller/auth_social.t index ec41dce77..bfb6017e2 100644 --- a/t/app/controller/auth_social.t +++ b/t/app/controller/auth_social.t @@ -33,7 +33,10 @@ my $fb_uid = 123456789; for my $fb_state ( 'refused', 'no email', 'existing UID', 'okay' ) { for my $page ( 'my', 'report', 'update' ) { subtest "test FB '$fb_state' login for page '$page'" => sub { + # Lots of user changes happening here, make sure we don't confuse + # Catalyst with a cookie session user that no longer exists $mech->log_out_ok; + $mech->cookie_jar({}); if ($fb_state eq 'existing UID') { my $user = $mech->create_user_ok($fb_email); $user->update({ facebook_id => $fb_uid }); diff --git a/t/app/controller/photo.t b/t/app/controller/photo.t index 39380e769..425e3c4df 100644 --- a/t/app/controller/photo.t +++ b/t/app/controller/photo.t @@ -65,10 +65,10 @@ subtest "Check multiple upload worked" => sub { ok $mech->success, 'Made request with multiple photo upload'; $mech->base_is('http://localhost/report/new'); $mech->content_like( - qr[(<img align="right" src="/photo/1cdd4329ceee2234bd4e89cb33b42061a0724687.temp.jpeg" alt="">\s*){3}], + qr[(<img align="right" src="/photo/temp.1cdd4329ceee2234bd4e89cb33b42061a0724687.jpeg" alt="">\s*){3}], 'Three uploaded pictures are all shown, safe'); $mech->content_contains( - 'name="upload_fileid" value="1cdd4329ceee2234bd4e89cb33b42061a0724687,1cdd4329ceee2234bd4e89cb33b42061a0724687,1cdd4329ceee2234bd4e89cb33b42061a0724687"', + 'name="upload_fileid" value="1cdd4329ceee2234bd4e89cb33b42061a0724687.jpeg,1cdd4329ceee2234bd4e89cb33b42061a0724687.jpeg,1cdd4329ceee2234bd4e89cb33b42061a0724687.jpeg"', 'Returned upload_fileid contains expected hash, 3 times'); my $image_file = path($UPLOAD_DIR, '1cdd4329ceee2234bd4e89cb33b42061a0724687.jpeg'); ok $image_file->exists, 'File uploaded to temp'; diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index cf72221b4..eb29d37da 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -420,7 +420,7 @@ foreach my $test ( changes => { photo1 => '', }, - errors => [ "Please upload a JPEG image only" ], + errors => [ "Please upload an image only" ], }, { msg => 'bad photo upload gives error', @@ -443,7 +443,7 @@ foreach my $test ( changes => { photo1 => '', }, - errors => [ "That image doesn't appear to have uploaded correctly (Please upload a JPEG image only ), please try again." ], + errors => [ "That image doesn't appear to have uploaded correctly (Please upload an image only ), please try again." ], }, { msg => 'photo with octet-stream gets through okay', diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 02625fcc7..9b446174d 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -12,6 +12,7 @@ $mech->create_body_ok(2514, 'Birmingham City Council'); my $body_edin_id = $mech->create_body_ok(2651, 'City of Edinburgh Council')->id; my $body_west_id = $mech->create_body_ok(2504, 'Westminster City Council')->id; my $body_fife_id = $mech->create_body_ok(2649, 'Fife Council')->id; +my $body_slash_id = $mech->create_body_ok(10000, 'Electricity/Gas Council')->id; $mech->delete_problems_for_body( $body_west_id ); $mech->delete_problems_for_body( $body_edin_id ); @@ -122,6 +123,10 @@ is scalar @$problems, 5, 'correct number of problems displayed'; FixMyStreet::override_config { MAPIT_URL => 'http://mapit.mysociety.org/', }, sub { + $mech->get_ok('/reports'); + $mech->follow_link_ok({ url_regex => qr{/reports/Electricity_Gas\+Council} }); + is $mech->uri->path, '/reports/Electricity_Gas+Council', 'Path is correct'; + $mech->get_ok('/reports/City+of+Edinburgh?t=new'); }; $problems = $mech->extract_problem_list; |