aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_inspect.t26
-rw-r--r--t/app/controller/report_new.t16
-rw-r--r--t/cobrand/oxfordshire.t51
3 files changed, 39 insertions, 54 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index 239cc408b..39dd57444 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -559,6 +559,7 @@ FixMyStreet::override_config {
my $expected_fields = {
state => 'action scheduled',
category => 'Cows',
+ non_public => undef,
public_update => '',
priority => $rp->id,
include_update => '1',
@@ -594,6 +595,31 @@ FixMyStreet::override_config {
is $report->comments->count, 1, "Only leaves one update";
like $report->comments->first->text, qr/Category changed.*Badgers/, 'update text included category change';
};
+
+ subtest "test non-public changing" => sub {
+ $report->comments->delete;
+ is $report->non_public, 0, 'Not set to non-public';
+ $mech->get_ok("/report/$report_id");
+ $mech->submit_form(button => 'save', with_fields => { include_update => 0, non_public => 1 });
+ is $report->comments->count, 0, "No updates left";
+ $report->discard_changes;
+ is $report->non_public, 1, 'Now set to non-public';
+ $mech->submit_form(button => 'save', with_fields => { include_update => 0, non_public => 0 });
+ is $report->comments->count, 0, "No updates left";
+ $report->discard_changes;
+ is $report->non_public, 0, 'Not set to non-public';
+ };
+
+ subtest "test saved-at setting" => sub {
+ $report->comments->delete;
+ $mech->get_ok("/report/$report_id");
+ my $now = DateTime->now->subtract(days => 1);
+ $mech->submit_form(button => 'save', form_id => 'report_inspect_form',
+ fields => { include_update => 1, public_update => 'An update', saved_at => $now->epoch });
+ $report->discard_changes;
+ is $report->comments->count, 1, "One update";
+ is $report->comments->first->confirmed, $now;
+ };
};
FixMyStreet::override_config {
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 3c120b0b0..32d86d803 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -1733,7 +1733,11 @@ subtest "extra google analytics code displayed on email confirmation problem cre
};
};
-subtest "inspectors get redirected directly to the report page" => sub {
+foreach my $test (
+ { non_public => 0 },
+ { non_public => 1 },
+) {
+ subtest "inspectors get redirected directly to the report page, non_public=$test->{non_public}" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
BASE_URL => 'https://www.fixmystreet.com',
@@ -1746,10 +1750,14 @@ subtest "inspectors get redirected directly to the report page" => sub {
body => $bodies[0],
permission_type => 'planned_reports',
});
+ $user->user_body_permissions->find_or_create({
+ body => $bodies[0],
+ permission_type => 'report_inspect',
+ });
$mech->log_in_ok('inspector@example.org');
$mech->get_ok('/');
- $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR' } },
+ $mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB' } },
"submit location" );
$mech->follow_link_ok(
{ text_regex => qr/skip this step/i, },
@@ -1766,6 +1774,7 @@ subtest "inspectors get redirected directly to the report page" => sub {
may_show_name => '1',
phone => '07903 123 456',
category => 'Trees',
+ non_public => $test->{non_public},
}
},
"submit good details"
@@ -1773,6 +1782,7 @@ subtest "inspectors get redirected directly to the report page" => sub {
like $mech->uri->path, qr/\/report\/[0-9]+/, 'Redirects directly to report';
}
-};
+ };
+}
done_testing();
diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t
index ee30e7e0b..54c6e32ea 100644
--- a/t/cobrand/oxfordshire.t
+++ b/t/cobrand/oxfordshire.t
@@ -185,57 +185,6 @@ subtest 'Reports are marked as inspected correctly' => sub {
};
};
-subtest 'response times messages displayed' => sub {
- my $oxfordshire = $mech->create_body_ok(
- 2237, 'Oxfordshire County Council'
- );
- my $contact = $mech->create_contact_ok(
- body_id => $oxfordshire->id,
- category => 'Pothole',
- email => 'pothole@example.com',
- );
-
- FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'oxfordshire' ],
- MAPIT_URL => 'http://mapit.uk/',
- }, sub {
- $mech->log_out_ok;
- $mech->clear_emails_ok;
-
- $mech->get_ok('/around');
- $mech->submit_form_ok( {
- with_fields => { pc => 'OX20 1SZ' }
- },
- "submit_location"
- );
-
- $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
- "follow 'skip this step' link" );
-
- $mech->submit_form_ok(
- {
- with_fields => {
- title => 'Test Report',
- detail => 'Test report details.',
- photo1 => '',
- username => 'test-2@example.com',
- name => 'Test User',
- category => 'Pothole',
- }
- },
- "submit details"
- );
-
- $mech->text_contains('Problems in the Pothole category are generally responded');
- my $email = $mech->get_email;
- ok $email, 'got and email';
- like $mech->get_text_body_from_email, qr/Problems in the Pothole category/, 'emails contains response time message';
- my $url = $mech->get_link_from_email($email);
- $mech->get_ok($url);
- $mech->text_contains('Problems in the Pothole category are generally responded')
- };
-};
-
END {
done_testing();
}