diff options
-rw-r--r-- | t/cobrand/get_council_sender.t | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/cobrand/get_council_sender.t b/t/cobrand/get_council_sender.t new file mode 100644 index 000000000..9004a47f5 --- /dev/null +++ b/t/cobrand/get_council_sender.t @@ -0,0 +1,30 @@ +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 $c->get_council_sender( '1000', { type => 'DIS' } ), 'Email', 'defaults to email'; +is $c->get_council_sender( '1000', { type => 'LBO' } ), 'London', 'returns london report it if London borough'; + +my $conf = FixMyStreet::App->model('DB::Open311Conf')->find_or_create( + area_id => 1000, + endpoint => '', + send_method => 'TestMethod' +); + +is $c->get_council_sender( '1000', { type => 'LBO' } ), 'TestMethod', 'uses send_method in preference to London'; +is $c->get_council_sender( '1000', { type => 'DIS' } ), 'TestMethod', 'uses send_method in preference to Email'; + +$conf->delete; + +done_testing(); |