aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/TestMech.pm
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2015-01-27 18:32:02 +0000
committerDave Arter <davea@mysociety.org>2015-10-06 09:09:22 +0100
commita78bb3fc98dd1851e371c78d9743125d02baf04e (patch)
treebe8bb660db9c982ac6b0b2add70a82acc01f30b9 /perllib/FixMyStreet/TestMech.pm
parentccc71f8f2d4a514f6ffaab2f3bbc76ea423f212b (diff)
Add support for multiple photos per report.
For Zurich, see mysociety/FixMyStreet-Commercial#664. This commit includes a new PhotoSet class (NB: called Model:: though not really a model), should handle binary data (e.g. old style photos in database), fileids (40-char hash), and Catalyst::Upload objects.
Diffstat (limited to 'perllib/FixMyStreet/TestMech.pm')
-rw-r--r--perllib/FixMyStreet/TestMech.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index bd2ca4096..ef60b0d36 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -631,7 +631,7 @@ sub create_problems_for_body {
latitude => '51.5016605453401',
longitude => '-0.142497580865087',
user_id => $user->id,
- photo => 1,
+ photo => $mech->get_photo_data,
};
my %report_params = ( %$default_params, %$params );
@@ -646,4 +646,13 @@ sub create_problems_for_body {
return @problems;
}
+sub get_photo_data {
+ my $mech = shift;
+ return $mech->{sample_photo} ||= do {
+ my $sample_file = FixMyStreet->path_to( 't/app/controller/sample.jpg' );
+ $mech->builder->ok( -f "$sample_file", "sample file $sample_file exists" );
+ $sample_file->slurp(iomode => '<:raw');
+ };
+}
+
1;