aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-01-16 11:47:20 +0000
committerStruan Donald <struan@exo.org.uk>2013-01-16 11:47:20 +0000
commit682db36dca4db6c0682deeb4fb704e8cf222e38c (patch)
tree5811b7e2288f48b0bc814f7f505e19cb705294d9 /t/open311
parent257b658e49da3665a426f1c98d9760b0d53b8d3d (diff)
parent3c4c0ec2f55d82502169d2313745920850efdc99 (diff)
Merge branch 'bromley-new-statuses'
Conflicts: bin/send-comments conf/crontab.ugly db/schema.sql perllib/FixMyStreet/App/Controller/Admin.pm perllib/FixMyStreet/DB/Result/Open311conf.pm perllib/FixMyStreet/DB/ResultSet/Problem.pm perllib/Open311.pm t/app/controller/report_updates.t t/open311.t templates/web/default/report/display.html templates/web/default/report/updates.html templates/web/fixmystreet/report/display.html
Diffstat (limited to 't/open311')
-rw-r--r--t/open311/getservicerequestupdates.t162
1 files changed, 148 insertions, 14 deletions
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t
index aba811e58..3f9c35c32 100644
--- a/t/open311/getservicerequestupdates.t
+++ b/t/open311/getservicerequestupdates.t
@@ -131,63 +131,197 @@ $problem->insert;
for my $test (
{
- desc => 'element with content',
+ desc => 'OPEN status for confirmed problem does not change state',
updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
description => 'This is a note',
external_id => 638344,
start_state => 'confirmed',
- close_comment => 0,
+ comment_status => 'OPEN',
mark_fixed=> 0,
mark_open => 0,
problem_state => undef,
end_state => 'confirmed',
},
{
- desc => 'comment closes report',
+ desc => 'bad state does not update states but does create update',
updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
description => 'This is a note',
external_id => 638344,
start_state => 'confirmed',
- close_comment => 1,
+ comment_status => 'INVALID_STATE',
+ mark_fixed=> 0,
+ mark_open => 0,
+ problem_state => undef,
+ end_state => 'confirmed',
+ },
+
+ {
+ desc => 'investigating status changes problem status',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'INVESTIGATING',
+ mark_fixed=> 0,
+ mark_open => 0,
+ problem_state => 'investigating',
+ end_state => 'investigating',
+ },
+ {
+ desc => 'in progress status changes problem status',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'IN_PROGRESS',
+ mark_fixed=> 0,
+ mark_open => 0,
+ problem_state => 'in progress',
+ end_state => 'in progress',
+ },
+ {
+ desc => 'action scheduled status changes problem status',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'ACTION_SCHEDULED',
+ mark_fixed=> 0,
+ mark_open => 0,
+ problem_state => 'action scheduled',
+ end_state => 'action scheduled',
+ },
+ {
+ desc => 'not responsible status changes problem status',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'NOT_COUNCILS_RESPONSIBILITY',
+ mark_fixed=> 0,
+ mark_open => 0,
+ problem_state => 'not responsible',
+ end_state => 'not responsible',
+ },
+ {
+ desc => 'duplicate status changes problem status',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'DUPLICATE',
+ mark_fixed=> 0,
+ mark_open => 0,
+ problem_state => 'duplicate',
+ end_state => 'duplicate',
+ },
+ {
+ desc => 'fixed status marks report as fixed - council',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'FIXED',
+ mark_fixed=> 0,
+ mark_open => 0,
+ problem_state => 'fixed - council',
+ end_state => 'fixed - council',
+ },
+ {
+ desc => 'status of CLOSED marks report as fixed - council',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'CLOSED',
mark_fixed=> 0,
mark_open => 0,
problem_state => 'fixed - council',
end_state => 'fixed - council',
},
{
- desc => 'comment re-opens fixed report',
+ desc => 'status of OPEN re-opens fixed report',
updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
description => 'This is a note',
external_id => 638344,
start_state => 'fixed - user',
- close_comment => 0,
+ comment_status => 'OPEN',
mark_fixed => 0,
mark_open => 0,
problem_state => 'confirmed',
end_state => 'confirmed',
},
{
- desc => 'comment re-opens closed report',
+ desc => 'action sheduled re-opens fixed report as action scheduled',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'fixed - user',
+ comment_status => 'ACTION_SCHEDULED',
+ mark_fixed => 0,
+ mark_open => 0,
+ problem_state => 'action scheduled',
+ end_state => 'action scheduled',
+ },
+ {
+ desc => 'open status re-opens closed report',
updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
description => 'This is a note',
external_id => 638344,
- start_state => 'closed',
- close_comment => 0,
+ start_state => 'not responsible',
+ comment_status => 'OPEN',
mark_fixed => 0,
mark_open => 0,
problem_state => 'confirmed',
end_state => 'confirmed',
},
{
- desc => 'comment leaves report closed',
+ desc => 'fixed status leaves fixed - user report as fixed - user',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'fixed - user',
+ comment_status => 'FIXED',
+ mark_fixed => 0,
+ mark_open => 0,
+ problem_state => undef,
+ end_state => 'fixed - user',
+ },
+ {
+ desc => 'closed status updates fixed report',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'fixed - user',
+ comment_status => 'NO_FURTHER_ACTION',
+ mark_fixed => 0,
+ mark_open => 0,
+ problem_state => 'unable to fix',
+ end_state => 'unable to fix',
+ },
+ {
+ desc => 'no futher action status closes report',
+ updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
+ description => 'This is a note',
+ external_id => 638344,
+ start_state => 'confirmed',
+ comment_status => 'NO_FURTHER_ACTION',
+ mark_fixed => 0,
+ mark_open => 0,
+ problem_state => 'unable to fix',
+ end_state => 'unable to fix',
+ },
+ {
+ desc => 'fixed status sets closed report as fixed',
updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ),
description => 'This is a note',
external_id => 638344,
- start_state => 'closed',
- close_comment => 1,
+ start_state => 'unable to fix',
+ comment_status => 'FIXED',
mark_fixed => 0,
mark_open => 0,
- end_state => 'closed',
+ problem_state => 'fixed - council',
+ end_state => 'fixed - council',
},
) {
subtest $test->{desc} => sub {
@@ -195,7 +329,7 @@ for my $test (
$local_requests_xml =~ s/UPDATED_DATETIME/$test->{updated_datetime}/;
$local_requests_xml =~ s#<service_request_id>\d+</service_request_id>#<service_request_id>@{[$problem->external_id]}</service_request_id>#;
$local_requests_xml =~ s#<service_request_id_ext>\d+</service_request_id_ext>#<service_request_id_ext>@{[$problem->id]}</service_request_id_ext>#;
- $local_requests_xml =~ s#<status>\w+</status>#<status>closed</status># if $test->{close_comment};
+ $local_requests_xml =~ s#<status>\w+</status>#<status>$test->{comment_status}</status># if $test->{comment_status};
my $o = Open311->new( jurisdiction => 'mysociety', endpoint => 'http://example.com', test_mode => 1, test_get_returns => { 'servicerequestupdates.xml' => $local_requests_xml } );