aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-01-12 16:37:45 +0000
committerMatthew Somerville <matthew@mysociety.org>2016-01-12 17:31:54 +0000
commitb8685054be0e16bc836dc568c0687a6f86400f38 (patch)
tree2cf64446203b4c9e8985a982e50d9c4f6b271df1 /t/app/controller
parentdf98fe4dfff0a707c9800050f658100c57783654 (diff)
Add ability to have multiple update photos.
Also adds admin ability to rotate update photos.
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/report_updates.t124
1 files changed, 92 insertions, 32 deletions
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index 4f55a387b..f9f5189e5 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -199,7 +199,9 @@ for my $test (
rznvy => '',
update => '',
name => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
fixed => undef,
add_alert => 1,
may_show_name => undef,
@@ -216,7 +218,9 @@ for my $test (
rznvy => 'test',
update => '',
name => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
fixed => undef,
add_alert => 1,
may_show_name => undef,
@@ -233,7 +237,9 @@ for my $test (
rznvy => 'test @ example. com',
update => '',
name => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
fixed => undef,
add_alert => 1,
may_show_name => undef,
@@ -252,7 +258,9 @@ for my $test (
rznvy => 'test@EXAMPLE.COM',
update => '',
name => '',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
fixed => undef,
add_alert => 1,
may_show_name => undef,
@@ -292,7 +300,9 @@ for my $test (
rznvy => '',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
remember_me => undef,
@@ -316,7 +326,9 @@ for my $test (
rznvy => '',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
remember_me => undef,
@@ -417,7 +429,9 @@ for my $test (
rznvy => '',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
remember_me => undef,
@@ -502,7 +516,9 @@ subtest 'check non authority user cannot change set state' => sub {
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'this is a forbidden update',
state => 'fixed - council',
},
@@ -530,7 +546,9 @@ for my $state ( qw/unconfirmed hidden partial/ ) {
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'this is a forbidden update',
state => $state,
},
@@ -553,7 +571,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to investigating',
state => 'investigating',
},
@@ -565,7 +585,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to in progress',
state => 'in progress',
},
@@ -577,7 +599,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to fixed',
state => 'fixed',
},
@@ -589,7 +613,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to action scheduled',
state => 'action scheduled',
},
@@ -601,7 +627,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to unable to fix',
state => 'unable to fix',
},
@@ -613,7 +641,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to internal referral',
state => 'internal referral',
},
@@ -626,7 +656,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to not responsible',
state => 'not responsible',
},
@@ -639,7 +671,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to duplicate',
state => 'duplicate',
},
@@ -652,7 +686,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to internal referral',
state => 'internal referral',
},
@@ -665,7 +701,9 @@ for my $test (
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Set state to fixed',
state => 'fixed',
},
@@ -783,7 +821,9 @@ subtest "check comment with no status change has not status in meta" => sub {
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Comment that does not change state',
},
},
@@ -813,7 +853,9 @@ subtest "check comment with no status change has not status in meta" => sub {
name => $user->name,
may_show_name => 1,
add_alert => undef,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => 'Comment that sets state to investigating',
state => 'investigating',
},
@@ -1059,7 +1101,9 @@ for my $test (
name => 'Test User',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
},
@@ -1069,7 +1113,7 @@ for my $test (
update => 'update from a registered user',
add_alert => undef,
fixed => undef,
- photo => [ [ $sample_file, undef, Content_Type => 'image/jpeg' ], 1 ],
+ photo1 => [ [ $sample_file, undef, Content_Type => 'image/jpeg' ], 1 ],
},
changed => {
update => 'Update from a registered user'
@@ -1085,7 +1129,9 @@ for my $test (
name => 'Test User',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
},
@@ -1111,7 +1157,9 @@ for my $test (
name => 'Test User',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
},
@@ -1136,7 +1184,9 @@ for my $test (
name => 'Commenter',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
},
@@ -1161,7 +1211,9 @@ for my $test (
name => 'Commenter',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
},
email => 'commenter@example.com',
@@ -1217,7 +1269,7 @@ for my $test (
my $update = $report->comments->first;
ok $update, 'found update';
- $mech->content_contains("/photo/c/" . $update->id . ".0.jpeg") if $test->{fields}->{photo};
+ $mech->content_contains("/photo/c/" . $update->id . ".0.jpeg") if $test->{fields}->{photo1};
if ( !defined( $test->{endstate_banner} ) ) {
is $mech->extract_problem_banner->{text}, undef, 'endstate banner';
@@ -1252,7 +1304,9 @@ foreach my $test (
name => 'Test User',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
},
@@ -1278,7 +1332,9 @@ foreach my $test (
name => 'Test User',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
},
@@ -1305,7 +1361,9 @@ foreach my $test (
name => 'Test User',
may_show_name => 1,
add_alert => 1,
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
update => '',
fixed => undef,
},
@@ -1778,7 +1836,9 @@ for my $test (
my %standard_fields = (
name => $report->user->name,
update => 'update text',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
may_show_name => 1,
add_alert => 1,
);