aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311/getservicerequestupdates.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-04-27 20:45:18 +0100
committerMatthew Somerville <matthew@mysociety.org>2016-04-27 20:45:18 +0100
commitbf165e6b5ab09e32b1806e06a837bda1bdec40db (patch)
tree8243a64cb5c930b3f14220537621f2f31b2342e0 /t/open311/getservicerequestupdates.t
parentdf4aaab5222604ff9803510f182701522882c309 (diff)
parent810759ae13d7dca1b16f36841ca7d364c1738cb5 (diff)
Merge branch 'open311-skip-out-of-range'
Diffstat (limited to 't/open311/getservicerequestupdates.t')
-rw-r--r--t/open311/getservicerequestupdates.t13
1 files changed, 7 insertions, 6 deletions
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t
index a57d2d0e6..134d5422e 100644
--- a/t/open311/getservicerequestupdates.t
+++ b/t/open311/getservicerequestupdates.t
@@ -38,7 +38,7 @@ UPDATED_DATETIME
};
-my $dt = DateTime->now;
+my $dt = DateTime->now(formatter => DateTime::Format::W3CDTF->new);
# basic xml -> perl object tests
for my $test (
@@ -571,7 +571,8 @@ subtest 'check that existing comments are not duplicated' => sub {
is $problem->comments->count, 1, 'one comment before fetching updates';
$requests_xml =~ s/UPDATED_DATETIME2/$dt/;
- $requests_xml =~ s/UPDATED_DATETIME/@{[ $comment->confirmed ]}/;
+ my $confirmed = DateTime::Format::W3CDTF->format_datetime($comment->confirmed);
+ $requests_xml =~ s/UPDATED_DATETIME/$confirmed/;
my $o = Open311->new( jurisdiction => 'mysociety', endpoint => 'http://example.com', test_mode => 1, test_get_returns => { 'servicerequestupdates.xml' => $requests_xml } );
@@ -596,12 +597,12 @@ subtest 'check that existing comments are not duplicated' => sub {
foreach my $test ( {
desc => 'check that closed and then open comment results in correct state',
- dt1 => $dt->subtract( hours => 1 ),
+ dt1 => $dt->clone->subtract( hours => 1 ),
dt2 => $dt,
},
{
desc => 'check that old comments do not change problem status',
- dt1 => $dt->subtract( hours => 2 ),
+ dt1 => $dt->clone->subtract( minutes => 90 ),
dt2 => $dt,
}
) {
@@ -627,7 +628,7 @@ foreach my $test ( {
$problem->comments->delete;
$problem->state( 'confirmed' );
- $problem->lastupdate( $dt->subtract( hours => 3 ) );
+ $problem->lastupdate( $dt->clone->subtract( hours => 3 ) );
$problem->update;
$requests_xml =~ s/UPDATED_DATETIME/$test->{dt1}/;
@@ -683,7 +684,7 @@ foreach my $test ( {
$problem->comments->delete;
$problem->state( 'confirmed' );
- $problem->lastupdate( $dt->subtract( hours => 3 ) );
+ $problem->lastupdate( $dt->clone->subtract( hours => 3 ) );
$problem->update;
my @alerts = map {