aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorGraeme Porteous <graeme@rgbp.co.uk>2019-12-18 16:16:54 +0000
committerDave Arter <davea@mysociety.org>2020-01-27 16:00:41 +0000
commit2d6af993630d9e43594975e093507ee62ed53b97 (patch)
tree514de24dd76344d88dcd5bf6494dbda519e90ebe /t
parent856ae6bed192345249df8569518a4ecd074b3dc0 (diff)
Add per report OpenGraph images
Includes a bit of refactoring of PhotoSet::get_image_data to make it easier to call subsequent methods on the photo object. We then do this to get the width and height. Also adds width/height attributes to FixMyStreet::ImageMagick Attributes are updated every time the image is transformed and before the as_blob data, which also undefs the image, is returned so it always present for subsequent calls. Fixes #2394.
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_display.t14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index fbb9d7b75..48a827a63 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -441,6 +441,20 @@ for my $test (
};
}
+subtest "Correct OpenGraph image is used when report has no photo" => sub {
+ $report->update({ photo => undef });
+ $mech->get_ok("/report/$report_id");
+ $mech->content_contains("/cobrands/fixmystreet/images/fms-og_image.jpg", "site image is used");
+ $mech->content_lacks("/photo/$report_id.0.og", "report image is not present");
+};
+
+subtest "Correct OpenGraph image is used when report has a photo" => sub {
+ $report->update({ photo => '74e3362283b6ef0c48686fb0e161da4043bbcc97.jpeg' });
+ $mech->get_ok("/report/$report_id");
+ $mech->content_contains("/photo/$report_id.0.og.jpeg", "report opengraph image is present");
+ $mech->content_lacks("/cobrands/fixmystreet/images/fms-og_image.jpg", "site image is not used");
+};
+
my $body_westminster = $mech->create_body_ok(2504, 'Westminster City Council');
my $body_camden = $mech->create_body_ok(2505, 'Camden Borough Council');