From 3f21a9742d89c3e4fda47a0be6ec2a17f802c99a Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Mon, 13 Feb 2017 15:13:12 +0000 Subject: Add customisable defect types. Problems can have an associated defect type, that can be assigned during an inspection. Include an admin interface for managing these types, that can also be assigned on a per-category basis, currently available to the Oxfordshire cobrand. (Also include 'TM' in traffic management Exor RDI output.) --- perllib/FixMyStreet/TestMech.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'perllib/FixMyStreet/TestMech.pm') diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 122a5d0c9..70d5c05ed 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -610,6 +610,7 @@ sub delete_body { my $body = shift; $mech->delete_problems_for_body($body->id); + $mech->delete_defect_type($_) for $body->defect_types; $mech->delete_contact($_) for $body->contacts; $mech->delete_user($_) for $body->users; $_->delete for $body->response_templates; @@ -641,6 +642,14 @@ sub delete_problems_for_body { } } +sub delete_defect_type { + my $mech = shift; + my $defect_type = shift; + + $defect_type->contact_defect_types->delete_all; + $defect_type->delete; +} + sub create_contact_ok { my $self = shift; my %contact_params = ( -- cgit v1.2.3 From 8bdf783d5d18dde25b4d2f8309a42c6096cf09d3 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 21 Mar 2017 17:23:07 +0000 Subject: Always include MapIt mock handler in all tests. --- perllib/FixMyStreet/TestMech.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'perllib/FixMyStreet/TestMech.pm') diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 122a5d0c9..902ae7a5a 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -10,6 +10,7 @@ BEGIN { } use Test::WWW::Mechanize::Catalyst 'FixMyStreet::App'; +use t::Mock::MapIt; use Test::More; use Web::Scraper; use Carp; -- cgit v1.2.3 From b26da0da5e1f8631646a34fdacbce9bb5bc3b706 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 17 Mar 2017 22:18:45 +0000 Subject: Upgrade to using Email::Sender. Email::Send is long deprecated and uses submodules that no longer work correctly (e.g. Net::SMTP::TLS breaks with recent IO::Socket::SSL). We create an Email::Sender subclass to perform the same functionality and this also simplifies the email code with simpler envelope handling. Bundle Email::Sender::Transport::SMTP to include fix from https://github.com/rjbs/Email-Sender/issues/46 --- perllib/FixMyStreet/TestMech.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'perllib/FixMyStreet/TestMech.pm') diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 122a5d0c9..c22789fb0 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -13,7 +13,7 @@ use Test::WWW::Mechanize::Catalyst 'FixMyStreet::App'; use Test::More; use Web::Scraper; use Carp; -use Email::Send::Test; +use FixMyStreet::Email::Sender; use JSON::MaybeXS; =head1 NAME @@ -182,7 +182,7 @@ Clear the email queue. sub clear_emails_ok { my $mech = shift; - Email::Send::Test->clear; + FixMyStreet::Email::Sender->default_transport->clear_deliveries; $mech->builder->ok( 1, 'cleared email queue' ); return 1; } @@ -199,7 +199,7 @@ sub email_count_is { my $mech = shift; my $number = shift || 0; - $mech->builder->is_num( scalar( Email::Send::Test->emails ), + $mech->builder->is_num( scalar( FixMyStreet::Email::Sender->default_transport->delivery_count ), $number, "checking for $number email(s) in the queue" ); } @@ -215,7 +215,8 @@ In list context returns all the emails (or none). sub get_email { my $mech = shift; - my @emails = Email::Send::Test->emails; + my @emails = FixMyStreet::Email::Sender->default_transport->deliveries; + @emails = map { $_->{email}->object } @emails; return @emails if wantarray; -- cgit v1.2.3