#!/usr/bin/perl -wT # vim: ft=xml: #---------------------------------------------------------------------- # heading : Configuration # description : E-mail # navigation : 6000 6700 # # copyright (C) 1999-2005 Mitel Networks Corporation # copyright (C) 2004 Shad L. Lords # copyright (C) 2005 Gordon Rowell # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Technical support for this program is available from Mitel Networks # Please visit our web site www.mitel.com/sme/ for details. #---------------------------------------------------------------------- use strict; use esmith::TestUtils; use esmith::FormMagick::Panel::emailsettings; my $f = esmith::FormMagick::Panel::emailsettings->new(); $f->display(); =head1 TESTING =begin testing use esmith::FormMagick::Tester; use esmith::TestUtils; use esmith::ConfigDB; my $panel = 'emailsettings'; my $panel_path = "/etc/e-smith/web/functions/".$panel; my $ua = esmith::FormMagick::Tester->new(); is (mode($panel_path), '4750', "Check permissions on script"); ok ($ua->get_panel($panel), "ABOUT TO RUN L10N TESTS"); is ($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/FORM_TITLE/, "Saw untranslated form title"); ok ($ua->set_language("en-us"), "Set language to U.S. English"); ok ($ua->get_panel($panel), "Get panel"); is ($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/E-mail settings/, "Saw translated form title"); # Testing changes ok ($ua->get_panel($panel), "Testing panel retrieval"); can_ok($ua, "field"); ok ($ua->{form}->find_input('FreqWeekend'), 'Finding the FreqWeekend field'); ok ($ua->{form}->find_input('SecondaryMailEnvelope'), 'Finding the SecondaryMailEnvelope field'); ok ($ua->{form}->find_input('SpecifyHeader'), 'Finding the SpecifyHeader field'); ok ($ua->{form}->find_input('SecondaryMailPassword'), 'Finding the SecondaryMailPassword field'); ok ($ua->{form}->find_input('FreqOffice'), 'Finding the FreqOffice field'); ok ($ua->{form}->find_input('SecondaryMailAccount'), 'Finding the SecondaryMailAccount field'); ok ($ua->{form}->find_input('SecondaryMailServer'), 'Finding the SecondaryMailServer field'); ok ($ua->{form}->find_input('FreqOutside'), 'Finding the FreqOutside field'); ok ($ua->{form}->find_input('DelegateMailServer'), 'Finding the DelegateMailServer field'); ok ($ua->{form}->find_input('FetchmailMethod'), 'Finding the FetchmailMethod field'); ok ($ua->get_panel($panel), "Testing panel retrieval"); can_ok($ua, "field"); ok ($ua->{form}->find_input('AdminEmail'), "Finding form field"); ok ($ua->{form}->find_input('EmailUnknownUser'), "Finding form field"); ok ($ua->{form}->find_input('SMTPSmartHost'), "Finding form field"); ok ($ua->{form}->find_input('POPAccess'), "Finding form field"); ok ($ua->{form}->find_input('WebMail'), "Finding form field"); SKIP: { skip 16, "Unsafe!" unless destruction_ok(); $ua->field('FreqWeekend' => 'never'); $ua->field('SecondaryMailEnvelope' => 'X-Recipient'); $ua->field('SpecifyHeader' => 'on'); $ua->field('SecondaryMailPassword' => 'poppassword'); $ua->field('FreqOffice' => 'every5min'); $ua->field('SecondaryMailAccount' => 'popaccount'); $ua->field('SecondaryMailServer' => 'ivy.fsck.com'); $ua->field('FreqOutside' => 'every30min'); $ua->field('DelegateMailServer' => '192.168.23.1'); $ua->field('FetchmailMethod' => 'etrn'); ok ($ua->click("Save"), "Click Save"); is ($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/settings have been saved/, "Saw validation messages"); # Gotta open this later, so we don't cache stale data my $db = esmith::ConfigDB->open; is ($db->get('fetchmail')->prop('FreqWeekend'), 'never', 'Validated value for FreqWeekend'); is ($db->get('fetchmail')->prop('SecondaryMailEnvelope'), 'X-Recipient', 'Validated value for SecondaryMailEnvelope'); is ($db->get('fetchmail')->prop('SecondaryMailPassword'), 'poppassword', 'Validated value for SecondaryMailPassword'); is ($db->get('fetchmail')->prop('FreqOffice'), 'every5min', 'Validated value for FreqOffice'); is ($db->get('fetchmail')->prop('SecondaryMailAccount'), 'popaccount', 'Validated value for SecondaryMailAccount'); is ($db->get('fetchmail')->prop('SecondaryMailServer'), 'ivy.fsck.com', 'Validated value for SecondaryMailServer'); is ($db->get('fetchmail')->prop('FreqOutside'), 'every30min', 'Validated value for FreqOutside'); is ($db->get('DelegateMailServer')->value(), '192.168.23.1', 'Validated value for DelegateMailServer'); is ($db->get('fetchmail')->prop('Method'), 'etrn', 'Validated value for FetchmailMethod'); ok ($ua->get_panel($panel), "Testing bogus IP Address"); can_ok($ua, "field"); $ua->field('DelegateMailServer' => '192.168.256.1'); is ($ua->{status}, 200, "200 OK"); unlike($ua->{content}, qr/settings have been saved/, "Didn't see validation message"); } SKIP: { skip 8, "Unsafe!" unless destruction_ok(); $ua->field("AdminEmail" => 'bob'); $ua->field("EmailUnknownUser" => 'returntosender'); $ua->field("SMTPSmartHost" => 'foo.example.com'); $ua->field("POPAccess" => 'public'); $ua->field("WebMail" => 'enabled'); ok ($ua->click("Save"), "Click Save"); is ($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/settings have been saved/, "Settings saved"); # Gotta open this later, so we don't cache stale data my $db = esmith::ConfigDB->open; my $adb = esmith::AccountsDB->open; is ($adb->get('admin')->prop('ForwardAddress'), 'bob', "Set the value for Email"); is ($db->get('EmailUnknownUser')->value(), 'returntosender', "Set the value for Email"); is ($db->get('SMTPSmartHost')->value(), 'foo.example.com', "Set the value for Smarthost"); is ($db->get('pop3')->prop('access'), 'public', "Set the value for POPAccess"); is ($db->get('horde')->prop('status'), 'enabled', "Set the value for web mail"); } =end testing =cut __DATA__
DESC_STATE_ACCESS_BUTTON DESC_SECTIONBAR DESC_STATE_FILTERING_BUTTON DESC_SECTIONBAR DESC_STATE_RECEPTION_BUTTON DESC_SECTIONBAR DESC_STATE_DELIVERY_BUTTON DESC_MODE DESC_SMTP_AUTH_CONTROL DESC_SECONDARY DESC_FETCH_PERIOD DESC_VIRUS_SCAN DESC_SPAM_SCAN DESC_SPAM_SUBJECT DESC_BLOCK_EXECUTABLE_CONTENT DESC_UNKNOWN DESC_DELEGATE DESC_SMARTHOST DESC_POP_ACCESS_CONTROL DESC_IMAP_ACCESS_CONTROL DESC_WEBMAIL SUCCESS