aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/sendreport/email.t
diff options
context:
space:
mode:
Diffstat (limited to 't/app/sendreport/email.t')
-rw-r--r--t/app/sendreport/email.t14
1 files changed, 10 insertions, 4 deletions
diff --git a/t/app/sendreport/email.t b/t/app/sendreport/email.t
index f0e1f153a..8063c928f 100644
--- a/t/app/sendreport/email.t
+++ b/t/app/sendreport/email.t
@@ -14,9 +14,14 @@ use mySociety::Locale;
my $e = FixMyStreet::SendReport::Email->new();
+# area id 1000
+my $params = { id => 1000, name => 'Council of the Thousand' };
+my $body = FixMyStreet::App->model('DB::Body')->find_or_create($params);
+ok $body, "found/created body";
+
my $contact = FixMyStreet::App->model('DB::Contact')->find_or_create(
email => 'council@example.com',
- area_id => 1000,
+ body_id => 1000,
category => 'category',
confirmed => 1,
deleted => 0,
@@ -26,8 +31,9 @@ my $contact = FixMyStreet::App->model('DB::Contact')->find_or_create(
);
my $row = FixMyStreet::App->model('DB::Problem')->new( {
- council => '1000',
+ bodies_str => '1000',
category => 'category',
+ cobrand => '',
} );
ok $e;
@@ -47,7 +53,7 @@ foreach my $test ( {
count => undef,
add_council => 1,
unconfirmed => 1,
- expected_note => 'Council 1000 deleted',
+ expected_note => 'Body 1000 deleted',
},
{
desc => 'unconfirmed contact note uses note from contact table',
@@ -62,7 +68,7 @@ foreach my $test ( {
my $e = FixMyStreet::SendReport::Email->new;
$contact->update( { confirmed => 0 } ) if $test->{unconfirmed};
$contact->update( { note => $test->{note} } ) if $test->{note};
- $e->add_council( 1000, { name => 'test council' } ) if $test->{add_council};
+ $e->add_body( $body ) if $test->{add_council};
is $e->build_recipient_list( $row, {} ), $test->{count}, 'correct recipient list count';
if ( $test->{unconfirmed} ) {