diff options
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/admin.t | 2 | ||||
-rw-r--r-- | t/app/controller/alert.t | 2 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 46 |
3 files changed, 48 insertions, 2 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index f8f280d63..007948299 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -1232,7 +1232,7 @@ subtest "Check admin_base_url" => sub { my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($report->cobrand)->new(); is ($report->admin_url($cobrand), - (sprintf 'https://secure.mysociety.org/admin/bci/report_edit/%d', $report_id), + (sprintf 'http://www.example.org/admin/report_edit/%d', $report_id), 'get_admin_url OK'); }; diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t index c7dc9ed09..c42eba6b8 100644 --- a/t/app/controller/alert.t +++ b/t/app/controller/alert.t @@ -29,7 +29,7 @@ FixMyStreet::override_config { $mech->title_like(qr/^Local RSS feeds and email alerts/); $mech->content_contains('Here are the types of local problem alerts for ‘EH99 1SP’'); $mech->content_contains('html class="no-js" lang="en-gb"'); - $mech->content_contains('Problems within 8.5km'); + $mech->content_contains('Problems within 10.0km'); $mech->content_contains('rss/pc/EH991SP/2'); $mech->content_contains('rss/pc/EH991SP/5'); $mech->content_contains('rss/pc/EH991SP/10'); diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index eb29d37da..9b10de2bf 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -701,6 +701,7 @@ subtest "test password errors for a user who is signing in as they report" => su subtest "test report creation for a user who is signing in as they report" => sub { $mech->log_out_ok; + $mech->cookie_jar({}); $mech->clear_emails_ok; # check that the user does not exist @@ -1319,6 +1320,13 @@ subtest "test Hart" => sub { ok $email, "got an email"; like $email->body, qr/to confirm that you want to send your/i, "confirm the problem"; + # does it reference the fact that this report hasn't been sent to Hart? + if ( $test->{national} ) { + like $email->body, qr/Hart Council is not responsible for this type/i, "mentions report hasn't gone to Hart"; + } else { + unlike $email->body, qr/Hart Council is not responsible for this type/i, "doesn't mention report hasn't gone to Hart"; + } + my ($url) = $email->body =~ m{(http://\S+)}; ok $url, "extracted confirm url '$url'"; @@ -1541,6 +1549,44 @@ subtest "unresponsive body handling works" => sub { like $email->body, qr/despite not being sent/i, "correct email sent"; $user->problems->delete; + $mech->clear_emails_ok; + + # Make sure the same behaviour occurs for reports from the mobile app + $mech->log_out_ok; + $mech->post_ok( '/report/new/mobile', { + title => "Test Report at cafĂ©", + detail => 'Test report details.', + photo1 => '', + name => 'Joe Bloggs', + email => $test_email, + may_show_name => '1', + phone => '07903 123 456', + category => 'Trees', + service => 'iOS', + lat => 55.9, + lon => -3.2, + pc => '', + used_map => '1', + submit_register => '1', + password_register => '', + }); + my $res = $mech->response; + ok $res->header('Content-Type') =~ m{^application/json\b}, 'response should be json'; + + $user = FixMyStreet::App->model('DB::User')->find( { email => $test_email } ); + ok $user, "test user does exist"; + + $report = $user->problems->first; + ok $report, "Found the report"; + is $report->bodies_str, undef, "Report not going anywhere"; + + $email = $mech->get_email; + ok $email, "got an email"; + like $email->body, qr/despite not being sent/i, "correct email sent"; + + $user->problems->delete; + $mech->clear_emails_ok; + $contact1->body->update( { send_method => $old_send } ); # And test per-category refusing |