aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-05-27 22:13:04 +0100
committerStruan Donald <struan@exo.org.uk>2012-05-27 22:13:04 +0100
commitb2f20914e30b0dfa0dbb689bcf02537f869f9f79 (patch)
tree5d0a762d7026517178e3ef79447472c085748782
parent6b26b7ec133eb9bdd4a9bed45477ec6d9d78304c (diff)
test FMS get_council_sender
-rw-r--r--t/cobrand/get_council_sender.t30
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();