From a7e31470b5e0dfabe04a9808e433fa754f67e8c7 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 20 Jun 2017 14:56:43 -0400 Subject: [PATCH] LP#1694696: add some unit tests for A/T helpers In particular, start with get_sms_gateway_email(). Signed-off-by: Galen Charlton --- .../perlmods/live_t/23-action-trigger-templates.t | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Open-ILS/src/perlmods/live_t/23-action-trigger-templates.t diff --git a/Open-ILS/src/perlmods/live_t/23-action-trigger-templates.t b/Open-ILS/src/perlmods/live_t/23-action-trigger-templates.t new file mode 100644 index 0000000000..cd71d82da5 --- /dev/null +++ b/Open-ILS/src/perlmods/live_t/23-action-trigger-templates.t @@ -0,0 +1,37 @@ +#!perl + +use strict; +use warnings; +use Test::More tests => 3; +use OpenILS::Utils::TestUtils; +use OpenILS::Const qw(:const); + +my $script = OpenILS::Utils::TestUtils->new(); +$script->bootstrap; + +use OpenILS::Application::Trigger::Reactor; +my $r = "OpenILS::Application::Trigger::Reactor"; + +my $env = { + carrier => 1, + number => '', + template => '[%- helpers.get_sms_gateway_email(carrier, number) -%]', +}; +my $addr = $r->run_TT($env, 1); +is($addr, '', 'helpers.get_sms_gateway_email: no number means no SMS gateway address'); + +$env = { + carrier => 1, + number => '9015551212', + template => '[%- helpers.get_sms_gateway_email(carrier, number) -%]', +}; +$addr = $r->run_TT($env, 1); +is($addr, 'opensrf+9015551212@localhost', 'helpers.get_sms_gateway_email: get back a SMS gateway address'); + +$env = { + carrier => '', + number => '9015551212', + template => '[%- helpers.get_sms_gateway_email(carrier, number) -%]', +}; +$addr = $r->run_TT($env, 1); +is($addr, '', 'helpers.get_sms_gateway_email: no carrier means no SMS gateway address'); -- 2.11.0