aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2020-08-06 09:43:53 +0100
committerStruan Donald <struan@exo.org.uk>2020-08-06 13:42:51 +0100
commit1e7cba67a53eead8cedcbf6aa7af12eb7ff4bf63 (patch)
treeeecc1d98b6e78c8b7695028f5e5dc2cf6c685df2 /t/open311
parentae687e6dd042982f2423d4e7e79e41c54d729e7b (diff)
[Open311] use staff categories when fetching reports
At the moment if you fetch a report in a staff category it will still be created but will be in the Other category. Given that some staff categories are marked as private this can allow reports that should be private to be put in a public category.
Diffstat (limited to 't/open311')
-rw-r--r--t/open311/getservicerequests.t40
1 files changed, 40 insertions, 0 deletions
diff --git a/t/open311/getservicerequests.t b/t/open311/getservicerequests.t
index 672459f3f..7a69d0ff6 100644
--- a/t/open311/getservicerequests.t
+++ b/t/open311/getservicerequests.t
@@ -534,6 +534,46 @@ subtest "non_public contacts result in non_public reports" => sub {
};
+subtest "staff and non_public contacts result in non_public reports" => sub {
+
+ $contact->update({
+ non_public => 1,
+ state => 'staff'
+ });
+ my $o = Open311->new(
+ jurisdiction => 'mysociety',
+ endpoint => 'http://example.com',
+ test_mode => 1,
+ test_get_returns => { 'requests.xml' => prepare_xml( {} ) }
+ );
+
+ my $update = Open311::GetServiceRequests->new(
+ system_user => $user,
+ start_date => $start_date,
+ end_date => $end_date
+ );
+
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $update->create_problems( $o, $body );
+ };
+
+ my $p = FixMyStreet::DB->resultset('Problem')->search(
+ { external_id => 123456, category => $contact->category }
+ )->first;
+
+ ok $p, 'problem created';
+ is $p->non_public, 1, "report non_public is set correctly";
+
+ $p->delete;
+ $contact->update({
+ non_public => 0,
+ state => 'confirmed'
+ });
+
+};
+
for my $test (
{
test_desc => 'filters out phone numbers',