aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311
diff options
context:
space:
mode:
Diffstat (limited to 't/open311')
-rw-r--r--t/open311/getservicerequestupdates.t30
-rw-r--r--t/open311/populate-service-list.t18
2 files changed, 23 insertions, 25 deletions
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t
index dac10d69b..0ab5b232d 100644
--- a/t/open311/getservicerequestupdates.t
+++ b/t/open311/getservicerequestupdates.t
@@ -18,6 +18,11 @@ my $user = FixMyStreet::App->model('DB::User')->find_or_create(
}
);
+my %bodies = (
+ 2482 => FixMyStreet::App->model("DB::Body")->new({ id => 2482 }),
+ 2651 => FixMyStreet::App->model("DB::Body")->new({ id => 2651 }),
+);
+
my $requests_xml = qq{<?xml version="1.0" encoding="utf-8"?>
<service_requests_updates>
<request_update>
@@ -342,9 +347,8 @@ for my $test (
$problem->state( $test->{start_state} );
$problem->update;
- my $council_details = { areas => { 2482 => 1 } };
my $update = Open311::GetServiceRequestUpdates->new( system_user => $user );
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{2482} );
is $problem->comments->count, 1, 'comment count';
$problem->discard_changes;
@@ -382,9 +386,8 @@ foreach my $test (
$problem->comments->delete;
- my $council_details = { areas => { 2482 => 1 } };
my $update = Open311::GetServiceRequestUpdates->new( system_user => $user );
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{2482} );
my $comment = $problem->comments->first;
is $comment->created, $dt, 'created date set to date from XML';
@@ -451,9 +454,8 @@ for my $test (
my $o = Open311->new( jurisdiction => 'mysociety', endpoint => 'http://example.com', test_mode => 1, test_get_returns => { 'servicerequestupdates.xml' => $local_requests_xml } );
- my $council_details = { areas => { $test->{area_id} => 1 } };
my $update = Open311::GetServiceRequestUpdates->new( system_user => $user );
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{$test->{area_id}} );
is $problem->comments->count, $test->{p1_comments}, 'comment count for first problem';
is $problem2->comments->count, $test->{p2_comments}, 'comment count for second problem';
@@ -491,8 +493,7 @@ subtest 'using start and end date' => sub {
end_date => $end_dt,
);
- my $council_details = { areas => { 2482 => 1 } };
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{2482} );
my $start = $start_dt . '';
my $end = $end_dt . '';
@@ -551,18 +552,17 @@ subtest 'check that existing comments are not duplicated' => sub {
system_user => $user,
);
- my $council_details = { areas => { 2482 => 1 } };
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{2482} );
$problem->discard_changes;
is $problem->comments->count, 2, 'two comments after fetching updates';
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{2482} );
$problem->discard_changes;
is $problem->comments->count, 2, 're-fetching updates does not add comments';
$problem->comments->delete;
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{2482} );
$problem->discard_changes;
is $problem->comments->count, 2, 'if comments are deleted then they are added';
};
@@ -612,8 +612,7 @@ foreach my $test ( {
system_user => $user,
);
- my $council_details = { areas => { 2482 => 1 } };
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{2482} );
$problem->discard_changes;
is $problem->comments->count, 2, 'two comments after fetching updates';
@@ -678,8 +677,7 @@ foreach my $test ( {
suppress_alerts => $test->{suppress_alerts},
);
- my $council_details = { areas => { 2482 => 1 } };
- $update->update_comments( $o, $council_details );
+ $update->update_comments( $o, $bodies{2482} );
$problem->discard_changes;
my $alerts_sent = FixMyStreet::App->model('DB::AlertSent')->search(
diff --git a/t/open311/populate-service-list.t b/t/open311/populate-service-list.t
index 99663030a..1574732fb 100644
--- a/t/open311/populate-service-list.t
+++ b/t/open311/populate-service-list.t
@@ -55,7 +55,7 @@ subtest 'check non open311 contacts marked as deleted' => sub {
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);
@@ -84,7 +84,7 @@ subtest 'check email changed if matching category' => sub {
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);
@@ -117,7 +117,7 @@ subtest 'check category name changed if updated' => sub {
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);
@@ -151,7 +151,7 @@ subtest 'check conflicting contacts not changed' => sub {
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);
@@ -166,7 +166,7 @@ subtest 'check conflicting contacts not changed' => sub {
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);
@@ -223,7 +223,7 @@ subtest 'check meta data population' => sub {
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);
@@ -403,7 +403,7 @@ for my $test (
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);
@@ -478,7 +478,7 @@ subtest 'check attribute ordering' => sub {
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);
@@ -580,7 +580,7 @@ subtest 'check bromely skip code' => sub {
confirmed => 1,
deleted => 0,
editor => $0,
- whenedited => \'ms_current_timestamp()',
+ whenedited => \'current_timestamp',
note => 'test contact',
}
);