diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-01-12 16:33:17 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-01-12 17:31:38 +0000 |
commit | df98fe4dfff0a707c9800050f658100c57783654 (patch) | |
tree | fd39aa3cf82584fbf784334da41265b5f7dbc43c /t/app/controller | |
parent | de6df5e30d4801afc560e93c833a692a117b9547 (diff) |
Factor multiple photo details into nicer function.
Remove get_photo_params, which only looked at the first photo,
make explicit when we're doing that using `.first`.
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/report_updates.t | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 6c6b4ca19..4f55a387b 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -1049,6 +1049,9 @@ subtest 'submit an update for a registered user, creating update by email' => su $mech->delete_user( $user ); }; +my $sample_file = file(__FILE__)->parent->file("sample.jpg")->stringify; +ok -e $sample_file, "sample file $sample_file exists"; + for my $test ( { desc => 'submit update for registered user', @@ -1066,6 +1069,7 @@ for my $test ( update => 'update from a registered user', add_alert => undef, fixed => undef, + photo => [ [ $sample_file, undef, Content_Type => 'image/jpeg' ], 1 ], }, changed => { update => 'Update from a registered user' @@ -1210,6 +1214,11 @@ for my $test ( $mech->content_contains("/report/" . $report_id); $mech->get_ok("/report/" . $report_id); + my $update = $report->comments->first; + ok $update, 'found update'; + + $mech->content_contains("/photo/c/" . $update->id . ".0.jpeg") if $test->{fields}->{photo}; + if ( !defined( $test->{endstate_banner} ) ) { is $mech->extract_problem_banner->{text}, undef, 'endstate banner'; } else { @@ -1223,8 +1232,6 @@ for my $test ( %{ $test->{changed} }, }; - my $update = $report->comments->first; - ok $update, 'found update'; is $update->text, $results->{update}, 'update text'; is $update->user->email, $test->{email}, 'update user'; is $update->state, 'confirmed', 'update confirmed'; |