aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2017-09-05 12:10:28 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-09-11 12:49:06 +0100
commit2cc255b912dc0f79de270be682a9e85d7fb95d7a (patch)
tree975b0c325836c33a5b548c65d66127802d25efe4 /t
parentc03096d4ffe3e17d504239ec4c0f006b1266c8e5 (diff)
[Oxfordshire] Log when problems sent by RDI email.
The timestamp of when a problem was included in an RDI is shown on the problem’s inspector form. Also check back and include any inspected reports that for some reason haven't been instructed yet. Fixes mysociety/fixmystreetforcouncils#223.
Diffstat (limited to 't')
-rw-r--r--t/cobrand/oxfordshire.t33
1 files changed, 32 insertions, 1 deletions
diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t
index 90fa8ccbf..e6c16950c 100644
--- a/t/cobrand/oxfordshire.t
+++ b/t/cobrand/oxfordshire.t
@@ -1,3 +1,5 @@
+use FixMyStreet::Integrations::ExorRDI;
+
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
@@ -47,6 +49,8 @@ my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super Us
my $inspector = $mech->create_user_ok('inspector@example.com', name => 'Inspector');
$inspector->user_body_permissions->create({ body => $oxon, permission_type => 'report_inspect' });
+my @problems = FixMyStreet::DB->resultset('Problem')->search({}, { rows => 3 })->all;
+
subtest 'Exor RDI download appears on Oxfordshire cobrand admin' => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ { 'oxfordshire' => '.' } ],
@@ -97,7 +101,6 @@ subtest 'Exor file looks okay' => sub {
$dt2->set_extra_metadata(activity_code => 'S');
$dt2->set_extra_metadata(defect_code => 'ACC2');
$dt2->update;
- my @problems = FixMyStreet::DB->resultset('Problem')->search({}, { rows => 3 })->all;
my $i = 123;
foreach my $problem (@problems) {
$problem->update({ state => 'action scheduled', external_id => $i });
@@ -142,9 +145,37 @@ subtest 'Exor file looks okay' => sub {
"P,0,999999"
"X,3,3,3,3,0,0,0,3,0,3,0,0,0"
EOF
+ foreach my $problem (@problems) {
+ $problem->discard_changes;
+ is $problem->get_extra_metadata('rdi_processed'), undef, "Problem was not logged as sent in RDI";
+ }
+
}
};
+subtest 'Reports are marked as inspected correctly' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'oxfordshire' ],
+ }, sub {
+ my $date = DateTime->new(year => 2017, month => 5, day => 5, hour => 12);
+ my $params = {
+ start_date => $date,
+ end_date => $date,
+ inspection_date => $date,
+ user => $inspector,
+ mark_as_processed => 1,
+ };
+ my $rdi = FixMyStreet::Integrations::ExorRDI->new($params);
+ $rdi->construct;
+
+ my $now = DateTime->now->strftime( '%Y-%m-%d %H:%M' );
+ foreach my $problem (@problems) {
+ $problem->discard_changes;
+ is $problem->get_extra_metadata('rdi_processed'), $now, "Problem was logged as sent in RDI";
+ }
+ };
+};
+
subtest 'response times messages displayed' => sub {
my $oxfordshire = $mech->create_body_ok(
2237, 'Oxfordshire County Council'