diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-12-13 18:53:25 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-12-15 00:11:06 +0000 |
commit | f05dc118efd45e0df7f3e8d04366f732440f4fd6 (patch) | |
tree | ecac77e56cb7c9d5b9c59ae7bfd6392123d9b279 /t/cobrand | |
parent | 9fb130a0ab1bd36e977439b7697fba5fec5b1f00 (diff) |
Update tests for new names of things and bodies needing to exist.
Diffstat (limited to 't/cobrand')
-rw-r--r-- | t/cobrand/closest.t | 2 | ||||
-rw-r--r-- | t/cobrand/get_body_sender.t | 34 | ||||
-rw-r--r-- | t/cobrand/get_council_sender.t | 30 |
3 files changed, 35 insertions, 31 deletions
diff --git a/t/cobrand/closest.t b/t/cobrand/closest.t index 464c95e67..ab97694c9 100644 --- a/t/cobrand/closest.t +++ b/t/cobrand/closest.t @@ -29,7 +29,7 @@ my $dt = DateTime->new( my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( { postcode => 'SW1A 1AA', - council => '2504', + bodies_str => '2504', areas => ',105255,11806,11828,2247,2504,', category => 'Other', title => 'Test 2', diff --git a/t/cobrand/get_body_sender.t b/t/cobrand/get_body_sender.t new file mode 100644 index 000000000..8475f5eed --- /dev/null +++ b/t/cobrand/get_body_sender.t @@ -0,0 +1,34 @@ +use strict; +use warnings; + +use Test::More; + +use mySociety::Locale; +use FixMyStreet::App; + +use_ok 'FixMyStreet::Cobrand'; + +mySociety::Locale::gettext_domain( 'FixMyStreet' ); + +my $c = FixMyStreet::Cobrand::FixMyStreet->new(); + +FixMyStreet::App->model('DB::Body')->search( { name => 'Body of a Thousand' } )->delete; + +my $body = FixMyStreet::App->model('DB::Body')->find_or_create({ + area_id => 1000, + name => 'Body of a Thousand', +}); +is_deeply $c->get_body_sender( $body ), { method => 'Email' }, 'defaults to email'; + +$body->area_id( 2481 ); # Croydon LBO +is_deeply $c->get_body_sender( $body ), { method => 'London' }, 'returns london report it if London borough'; + +$body->send_method( 'TestMethod' ); +is $c->get_body_sender( $body )->{ method }, 'TestMethod', 'uses send_method in preference to London'; + +$body->area_id( 1000 ); # Nothing +is $c->get_body_sender( $body )->{ method }, 'TestMethod', 'uses send_method in preference to Email'; + +$body->delete; + +done_testing(); diff --git a/t/cobrand/get_council_sender.t b/t/cobrand/get_council_sender.t deleted file mode 100644 index c05864d8a..000000000 --- a/t/cobrand/get_council_sender.t +++ /dev/null @@ -1,30 +0,0 @@ -use strict; -use warnings; - -use Test::More; - -use mySociety::Locale; -use FixMyStreet::App; - -use_ok 'FixMyStreet::Cobrand'; - -mySociety::Locale::gettext_domain( 'FixMyStreet' ); - -my $c = FixMyStreet::Cobrand::FixMyStreet->new(); - - -is_deeply $c->get_council_sender( '1000', { type => 'DIS' } ), { method => 'Email' }, 'defaults to email'; -is_deeply $c->get_council_sender( '1000', { type => 'LBO' } ), { method=> 'London' }, 'returns london report it if London borough'; - -my $conf = FixMyStreet::App->model('DB::Body')->find_or_create( - area_id => 1000, - endpoint => '', - send_method => 'TestMethod' -); - -is $c->get_council_sender( '1000', { type => 'LBO' } )->{ method }, 'TestMethod', 'uses send_method in preference to London'; -is $c->get_council_sender( '1000', { type => 'DIS' } )->{ method }, 'TestMethod', 'uses send_method in preference to Email'; - -$conf->delete; - -done_testing(); |