diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/admin/defecttypes.t | 14 | ||||
-rw-r--r-- | t/app/sendreport/blackhole.t | 42 |
2 files changed, 56 insertions, 0 deletions
diff --git a/t/app/controller/admin/defecttypes.t b/t/app/controller/admin/defecttypes.t index e7d0e42af..1eaab8414 100644 --- a/t/app/controller/admin/defecttypes.t +++ b/t/app/controller/admin/defecttypes.t @@ -28,6 +28,20 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => ['oxfordshire'], }, sub { my $body = $mech->create_body_ok( 2237, 'Oxfordshire County Council' ); + subtest 'check defect types menu available to superusers' => sub { + my $user = $mech->create_user_ok( + 'superuser@example.com', + name => 'Test Superuser', + is_superuser => 1 + ); + + $mech->log_in_ok( $user->email ); + $mech->get_ok('/admin'); + $mech->content_contains('Defect Types'); + $mech->get_ok('/admin/defecttypes'); + $mech->log_out_ok(); + }; + my $user = $mech->create_user_ok( 'oxford@example.com', name => 'Test User', diff --git a/t/app/sendreport/blackhole.t b/t/app/sendreport/blackhole.t new file mode 100644 index 000000000..4335f3675 --- /dev/null +++ b/t/app/sendreport/blackhole.t @@ -0,0 +1,42 @@ +use FixMyStreet; +use FixMyStreet::DB; +use FixMyStreet::TestMech; +use FixMyStreet::Script::Reports; + +ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); + +my $user = $mech->create_user_ok( 'user@example.com' ); + +my $body = $mech->create_body_ok( 2551, 'Bath and North East Somerset Council'); +$body->update({ can_be_devolved => 1 }); + +my $contact = $mech->create_contact_ok( + body_id => $body->id, + category => 'Play area safety issue', + email => 'test@example.org', + send_method => 'Blackhole', +); + +my @reports = $mech->create_problems_for_body( 1, $body->id, 'Test', { + cobrand => 'bathnes', + category => $contact->category, + user => $user, +}); +my $report = $reports[0]; + +FixMyStreet::override_config { + STAGING_FLAGS => { send_reports => 1 }, +}, sub { + subtest "Report isn't sent anywhere" => sub { + $mech->clear_emails_ok; + + FixMyStreet::Script::Reports::send(); + + ok $mech->email_count_is(0), "Report email wasn't sent"; + + $report->discard_changes; + ok $report->whensent, "Report has been marked as sent"; + }; +}; + +done_testing(); |