diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-01-20 13:05:42 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-01-20 13:10:52 +0000 |
commit | 18ab1363f57e5db40a1103c1c89cb423de1b5274 (patch) | |
tree | 58dc3106a18f8c3d49c3f484fced9b2d419226bd | |
parent | c4d726bacd492bd4281b9eddbdc29d3190444d3c (diff) |
Add tests for admin message, cobrand email alert.
-rw-r--r-- | t/app/controller/admin.t | 4 | ||||
-rw-r--r-- | t/cobrand/fixmybarangay.t | 23 |
2 files changed, 24 insertions, 3 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 58d7e0e96..f63a72117 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -266,7 +266,7 @@ subtest 'check open311 configuring' => sub { } ); $mech->content_contains('Council contacts configured via Open311'); - $mech->content_contains('Configuration updated - contacts will be generated automatically later'); + $mech->content_contains('Values updated'); my $conf = FixMyStreet::App->model('DB::Body')->find( $body->id ); is $conf->endpoint, 'http://example.com/open311', 'endpoint configured'; @@ -286,7 +286,7 @@ subtest 'check open311 configuring' => sub { } ); - $mech->content_contains('Configuration updated'); + $mech->content_contains('Values updated'); $conf = FixMyStreet::App->model('DB::Body')->find( $body->id ); is $conf->endpoint, 'http://example.org/open311', 'endpoint updated'; diff --git a/t/cobrand/fixmybarangay.t b/t/cobrand/fixmybarangay.t index a431ca62b..edb14fe3d 100644 --- a/t/cobrand/fixmybarangay.t +++ b/t/cobrand/fixmybarangay.t @@ -28,7 +28,7 @@ $luz->update( { send_method => 'Email' } ); my $bsn = $mech->create_body_ok( 2, 'Bgy BSN', id => 2 ); $bsn->update( { send_method => 'Email' } ); -my $dps = $mech->create_body_ok( 3, 'DPS' ); +my $dps = $mech->create_body_ok( 3, 'DPS', id => 3 ); $dps->update( { send_method => 'Open311', endpoint => 'http://dps.endpoint.example.com', jurisdiction => 'FMB', api_key => 'test' } ); FixMyStreet::App->model('DB::BodyArea')->find_or_create({ area_id => 1, body_id => $dps->id }); FixMyStreet::App->model('DB::BodyArea')->find_or_create({ area_id => 2, body_id => $dps->id }); @@ -104,6 +104,27 @@ my $fmb_test_email = 'luz_test_user@example.com'; my $user = FixMyStreet::App->model('DB::User')->find_or_create( { email => $fmb_test_email, from_body => $luz->id, password => 'fmbsecret' } ); ok $user, "test user does exist"; +my $alert = FixMyStreet::App->model('DB::Alert')->find_or_create({ + user => $user, + parameter => '-0.142497580865087', + parameter2 => '51.5016605453401', + alert_type => 'local_problems', + whensubscribed => '2014-01-01 10:00:00', + confirmed => 1, + cobrand => 'fixmybarangay', +}); + +FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'fixmybarangay' ], +}, sub { + FixMyStreet::App->model('DB::AlertType')->email_alerts(); +}; + +$mech->email_count_is(1); +$email = $mech->get_email; +like $email->body, qr/The following FixMyBarangay reports/, 'Start of email looks correct'; +$mech->clear_emails_ok; + $mech->log_out_ok; $mech->get_ok( '/report/' . $luz_report->id ); $mech->content_lacks( "Remove from site" ); |