aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-07-08 15:38:10 +0100
committerDave Arter <davea@mysociety.org>2016-07-08 15:38:10 +0100
commit0c5549a60ef3d86d672926d6e71c00cafff8326b (patch)
tree94158b497072156c273f442ce19888665a205a2c /t/app/controller
parent680893b2489830b0c06a6ffdbf8c9f15ddb22487 (diff)
parent8a8b34b66dbdb9d2ce9c5b2d00318d75ef93d267 (diff)
Merge branch 'issues/commercial/500-cobrand-reporting-issues-redux'
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/report_new.t45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index ba550193e..9b10de2bf 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -1320,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'";
@@ -1542,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