diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-07-13 12:02:53 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-07-13 12:02:53 +0100 |
commit | fc7935e5428ef80ecea46211fd4faf317079cd9c (patch) | |
tree | bd0b1637e52f17158642baf902e72f98c14b96ff | |
parent | db3e6eec80cc6365a7d63035d8df7949c7a4ccf7 (diff) |
Test to close #18 (was fixed in Catalyst migration).
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 4 | ||||
-rw-r--r-- | t/app/controller/report_import.t | 29 | ||||
-rw-r--r-- | templates/web/default/admin/timeline.html | 2 |
3 files changed, 32 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 01cad9bba..ac8143718 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -227,8 +227,8 @@ sub report_import : Path('/import') { ); # If there was a photo add that too - if ( my $fileid = $c->stash->{upload_fileid} ) { - my $file = file( $c->config->{UPLOAD_CACHE}, "$fileid.jpg" ); + if ( $photo ) { + my $file = file( $c->config->{UPLOAD_CACHE}, "$photo.jpg" ); my $blob = $file->slurp; $file->remove; $report->photo($blob); diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t index 42b05e2b8..61ee28b88 100644 --- a/t/app/controller/report_import.t +++ b/t/app/controller/report_import.t @@ -127,6 +127,35 @@ subtest "Submit a correct entry" => sub { }, "check imported fields are shown"; + # Check photo present, and still there after map submission (testing bug #18) + $mech->content_contains( '<img align="right" src="/photo?id' ); + $mech->content_contains('latitude" value="51.50101"', 'Check latitude'); + $mech->content_contains('longitude" value="-0.141587"', 'Check longitude'); + $mech->submit_form_ok( + { + button => 'tile_32742.21793', + x => 10, + y => 10, + }, + "New map location" + ); + $mech->content_contains( '<img align="right" src="/photo?id' ); + $mech->content_contains('latitude" value="51.50519"', 'Check latitude'); + $mech->content_contains('longitude" value="-0.142608"', 'Check longitude'); + + # check that fields haven't changed at all + is_deeply $mech->visible_form_values, + { + name => 'Test User', + title => 'Test report', + detail => 'This is a test report', + photo => '', + phone => '', + may_show_name => '1', + category => '-- Pick a category --', + }, + "check imported fields are shown"; + # change the details $mech->submit_form_ok( # { diff --git a/templates/web/default/admin/timeline.html b/templates/web/default/admin/timeline.html index a7f4f3628..95120e48c 100644 --- a/templates/web/default/admin/timeline.html +++ b/templates/web/default/admin/timeline.html @@ -32,7 +32,7 @@ [% tprintf(loc("Questionnaire %d answered for problem %d, %s to %s"), item.obj.id, item.obj.problem_id, item.obj.old_state, item.obj.new_state ) %] [% CASE 'update' %] [% name = ( item.obj.name || 'anonymous' ) | html %] - [% tprintf(loc("Update %s created for problem %d; by %s"), "<a href='" _ c.uri_for_email( '/report', item.obj.problem_id, c.cobrand_data ) _ "#update_" _ item.obj.id _ "'>" _ item.obj.id _ "</a>", item.obj.problem_id, name) %]<[% item.obj.user.email | html %]> + [% tprintf(loc("Update %s created for problem %d; by %s"), "<a href='" _ c.uri_for_email( '/report', item.obj.problem_id, c.cobrand_data ) _ "#update_" _ item.obj.id _ "'>" _ item.obj.id _ "</a>", item.obj.problem_id, name) %] <[% item.obj.user.email | html %]> [% CASE 'alertSub' %] [% tprintf(loc("Alert %d created for %s, type %s, parameters %s / %s"), item.obj.id, item.obj.user.email, item.obj.alert_type.ref, item.obj.parameter, item.obj.parameter2) | html %] [% CASE 'alertDel' %] |