aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/photo.t3
-rw-r--r--t/app/controller/report_import.t12
-rw-r--r--t/app/controller/report_new.t94
-rw-r--r--t/app/controller/report_new_open311.t4
4 files changed, 78 insertions, 35 deletions
diff --git a/t/app/controller/photo.t b/t/app/controller/photo.t
index 6e61ebb32..39380e769 100644
--- a/t/app/controller/photo.t
+++ b/t/app/controller/photo.t
@@ -64,6 +64,9 @@ 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}],
+ 'Three uploaded pictures are all shown, safe');
$mech->content_contains(
'name="upload_fileid" value="1cdd4329ceee2234bd4e89cb33b42061a0724687,1cdd4329ceee2234bd4e89cb33b42061a0724687,1cdd4329ceee2234bd4e89cb33b42061a0724687"',
'Returned upload_fileid contains expected hash, 3 times');
diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t
index 4d0f6e5d1..1d6695996 100644
--- a/t/app/controller/report_import.t
+++ b/t/app/controller/report_import.t
@@ -153,7 +153,9 @@ subtest "Submit a correct entry" => sub {
name => 'Test User',
title => 'Test report',
detail => 'This is a test report',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
phone => '',
may_show_name => '1',
category => '-- Pick a category --',
@@ -187,7 +189,9 @@ subtest "Submit a correct entry" => sub {
name => 'Test User',
title => 'Test report',
detail => 'This is a test report',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
phone => '',
may_show_name => '1',
category => '-- Pick a category --',
@@ -275,7 +279,9 @@ subtest "Submit a correct entry (with location)" => sub {
name => 'Test User ll',
title => 'Test report ll',
detail => 'This is a test report ll',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
phone => '',
may_show_name => '1',
category => '-- Pick a category --',
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 3c05adfbd..4258a46a1 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -103,7 +103,9 @@ foreach my $test (
fields => {
title => '',
detail => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => '',
may_show_name => '1',
email => '',
@@ -127,7 +129,9 @@ foreach my $test (
fields => {
title => '',
detail => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => '',
may_show_name => '1',
email => '',
@@ -154,7 +158,9 @@ foreach my $test (
fields => {
title => '',
detail => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => '',
may_show_name => '1',
email => '',
@@ -178,7 +184,9 @@ foreach my $test (
fields => {
title => '',
detail => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => '',
may_show_name => undef,
email => '',
@@ -202,7 +210,9 @@ foreach my $test (
fields => {
title => '',
detail => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => 'Bob Jones',
may_show_name => undef,
email => '',
@@ -225,7 +235,9 @@ foreach my $test (
fields => {
title => '',
detail => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => 'Bob Jones',
may_show_name => '1',
email => '',
@@ -248,7 +260,9 @@ foreach my $test (
fields => {
title => "DOG SHIT\r\nON WALLS",
detail => "on this portakabin -\r\n\r\nmore of a portaloo HEH!!",
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => 'Bob Jones',
may_show_name => '1',
email => '',
@@ -271,7 +285,9 @@ foreach my $test (
fields => {
title => 'Test title',
detail => 'Test detail',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => 'DUDE',
may_show_name => '1',
email => '',
@@ -293,7 +309,9 @@ foreach my $test (
fields => {
title => 'Test title',
detail => 'Test detail',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => 'anonymous',
may_show_name => '1',
email => '',
@@ -315,7 +333,9 @@ foreach my $test (
fields => {
title => 'Test title',
detail => 'Test detail',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => 'Joe Smith',
may_show_name => '1',
email => 'not an email',
@@ -334,7 +354,9 @@ foreach my $test (
fields => {
title => " Test title ",
detail => " first line \n\n second\nline\n\n ",
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => '',
may_show_name => '1',
email => '',
@@ -359,7 +381,9 @@ foreach my $test (
fields => {
title => '',
detail => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => ' Bob Jones ',
may_show_name => '1',
email => ' BOB @ExAmplE.COM ',
@@ -381,7 +405,9 @@ foreach my $test (
fields => {
title => 'Title',
detail => 'Detail',
- photo => [ [ undef, 'bad.txt', Content => 'This is not a JPEG', Content_Type => 'text/plain' ], 1 ],
+ photo1 => [ [ undef, 'bad.txt', Content => 'This is not a JPEG', Content_Type => 'text/plain' ], 1 ],
+ photo2 => '',
+ photo3 => '',
name => 'Bob Jones',
may_show_name => '1',
email => 'bob@example.com',
@@ -392,7 +418,7 @@ foreach my $test (
remember_me => undef,
},
changes => {
- photo => '',
+ photo1 => '',
},
errors => [ "Please upload a JPEG image only" ],
},
@@ -402,7 +428,9 @@ foreach my $test (
fields => {
title => 'Title',
detail => 'Detail',
- photo => [ [ undef, 'fake.jpeg', Content => 'This is not a JPEG', Content_Type => 'image/jpeg' ], 1 ],
+ photo1 => [ [ undef, 'fake.jpeg', Content => 'This is not a JPEG', Content_Type => 'image/jpeg' ], 1 ],
+ photo2 => '',
+ photo3 => '',
name => 'Bob Jones',
may_show_name => '1',
email => 'bob@example.com',
@@ -413,7 +441,7 @@ foreach my $test (
remember_me => undef,
},
changes => {
- photo => '',
+ photo1 => '',
},
errors => [ "That image doesn't appear to have uploaded correctly (Please upload a JPEG image only ), please try again." ],
},
@@ -423,7 +451,9 @@ foreach my $test (
fields => {
title => '',
detail => 'Detail',
- photo => [ [ $sample_file, undef, Content_Type => 'application/octet-stream' ], 1 ],
+ photo1 => [ [ $sample_file, undef, Content_Type => 'application/octet-stream' ], 1 ],
+ photo2 => '',
+ photo3 => '',
name => 'Bob Jones',
may_show_name => '1',
email => 'bob@example.com',
@@ -434,7 +464,7 @@ foreach my $test (
remember_me => undef,
},
changes => {
- photo => '',
+ photo1 => '',
},
errors => [ "Please enter a subject" ],
},
@@ -534,7 +564,7 @@ foreach my $test (
with_fields => {
title => 'Test Report',
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
name => 'Joe Bloggs',
may_show_name => '1',
email => 'test-1@example.com',
@@ -652,7 +682,7 @@ subtest "test password errors for a user who is signing in as they report" => su
with_fields => {
title => 'Test Report',
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
email => 'test-2@example.com',
password_sign_in => 'secret1',
category => 'Street lighting',
@@ -704,7 +734,7 @@ subtest "test report creation for a user who is signing in as they report" => su
with_fields => {
title => 'Test Report',
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
email => 'test-2@example.com',
password_sign_in => 'secret2',
category => 'Street lighting',
@@ -803,7 +833,9 @@ foreach my $test (
may_show_name => '1',
name => 'Test User',
phone => '01234 567 890',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
category => '-- Pick a category --',
},
"user's details prefilled"
@@ -814,7 +846,7 @@ foreach my $test (
with_fields => {
title => "Test Report at café",
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
name => 'Joe Bloggs',
may_show_name => '1',
phone => '07903 123 456',
@@ -898,7 +930,7 @@ subtest "test report creation for a category that is non public" => sub {
with_fields => {
title => 'Test Report',
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
email => 'test-2@example.com',
name => 'Joe Bloggs',
category => 'Street lighting',
@@ -1087,7 +1119,7 @@ for my $test (
my $submission_fields = {
title => "Test Report",
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
email => 'firstlast@example.com',
may_show_name => '1',
phone => '07903 123 456',
@@ -1156,7 +1188,7 @@ subtest 'user title not reset if no user title in submission' => sub {
my $submission_fields = {
title => "Test Report",
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
name => 'Has Title',
may_show_name => '1',
phone => '07903 123 456',
@@ -1250,7 +1282,7 @@ subtest "test Hart" => sub {
with_fields => {
title => 'Test Report',
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
name => 'Joe Bloggs',
may_show_name => '1',
category => $test->{category},
@@ -1484,7 +1516,7 @@ subtest "unresponsive body handling works" => sub {
with_fields => {
title => "Test Report at café",
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
name => 'Joe Bloggs',
email => $test_email,
may_show_name => '1',
@@ -1523,7 +1555,7 @@ subtest "unresponsive body handling works" => sub {
with_fields => {
title => "Test Report at café",
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
name => 'Joe Bloggs',
email => $test_email,
may_show_name => '1',
@@ -1604,7 +1636,7 @@ subtest "extra google analytics code displayed on logged in problem creation" =>
with_fields => {
title => "Test Report at café",
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
name => 'Joe Bloggs',
may_show_name => '1',
phone => '07903 123 456',
@@ -1646,7 +1678,7 @@ subtest "extra google analytics code displayed on email confirmation problem cre
my $submission_fields = {
title => "Test Report",
detail => 'Test report details.',
- photo => '',
+ photo1 => '',
email => 'firstlast@example.com',
name => 'Test User',
may_show_name => '1',
diff --git a/t/app/controller/report_new_open311.t b/t/app/controller/report_new_open311.t
index d3ca93f0e..b29642abe 100644
--- a/t/app/controller/report_new_open311.t
+++ b/t/app/controller/report_new_open311.t
@@ -45,7 +45,9 @@ foreach my $test (
fields => {
title => '',
detail => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
name => '',
may_show_name => '1',
email => '',