diff options
Diffstat (limited to 't/open311/getservicerequests.t')
-rw-r--r-- | t/open311/getservicerequests.t | 40 |
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', |