#!/usr/bin/perl -wT # vim: ft=xml ts=4 sw=4 et: #---------------------------------------------------------------------- # heading : Collaboration # description : Users # navigation : 2000 2100 #---------------------------------------------------------------------- #---------------------------------------------------------------------- # copyright (C) 2002 Mitel Networks Corporation # # 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::useraccounts; my $fm = esmith::FormMagick::Panel::useraccounts->new(); # XXX: need to print custom http headers, so bypass FormMagick use CGI; my $q = new CGI; if ($q->param('action') && $q->param('action') eq 'getCert') { $q->delete('action'); $fm->get_ipsec_client_cert($q); } else { $fm->display(); } =pod =head1 NAME useraccounts -- create/modify/delete user accounts =head2 DESCRIPTION This screen allows the administrator to create, modify or delete user accounts on the system. =begin testing use esmith::FormMagick::Tester; use esmith::TestUtils; use esmith::ConfigDB; use esmith::AccountsDB; my $panel = $Original_File; my $ua = esmith::FormMagick::Tester->new(); my $c = esmith::ConfigDB->open(); my $a = esmith::AccountsDB->open(); is (mode($panel), '4755', "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/User accounts/, "Saw translated form title"); # # Testing creating users # ok ($ua->get_panel($panel), "ABOUT TO TEST CREATING USER"); ok ($ua->follow("Click here"), "Follow 'create user' link"); is ($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/Account name/, "Saw form fields"); # # Check that address details are picked up from LDAP # my $ldap_record = $c->get('ldap'); my $city = $ldap_record->prop('DefaultCity'); like($ua->{content}, qr/$city/, "Pick up address from LDAP"); # # Creating a new user # my $new_username = new_random_username(); can_ok($ua, "field"); ok ($ua->{form}->find_input('acctName'), "Find acctName field to fill in"); $ua->field("acctName" => $new_username); ok ($ua->click("Save"), "Click Save"); is ($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/must not be left blank/, "Saw validation messages"); $ua->field("FirstName" => "Fred"); $ua->field("LastName" => "Foonly"); ok ($ua->click("Save"), "Click Save"); is ($ua->{status}, 200, "200 OK"); # # Testing modify user # ok ($ua->get_panel($panel), "ABOUT TO TEST MODIFYING A USER"); is ($ua->{status}, 200, "200 OK"); ok ($ua->follow('Modify'), "Follow modify link"); is ($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/value="Save"/, "Saw 'Save' on the button"); # # Testing removal of a user # ok ($ua->get_panel($panel), "ABOUT TO TEST USER REMOVAL"); is ($ua->{status}, 200, "200 OK"); ok ($ua->follow('Remove'), "Follow remove link"); is ($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/Remove/, "Saw 'Remove'"); like($ua->{content}, qr/value="Remove"/, "Saw 'Remove' on the button"); # # Testing password reset # ok ($ua->get_panel($panel), "ABOUT TO TEST PASSWORD RESET"); is ($ua->{status}, 200, "200 OK"); ok ($ua->follow('Reset password'), "Follow reset password link"); like($ua->{content}, qr/Reset password/,"Saw 'Reset password'"); SKIP: { skip 3, "Unsafe!" unless destruction_ok(); $ua->field(password1 => "test"); $ua->field(password2 => "test"); ok($ua->click('Save'), "Set password to 'test', click Save"); is($ua->{status}, 200, "200 OK"); like($ua->{content}, qr/Click here/, "Returned to first page"); } =end testing =cut __DATA__
FIRSTPAGE_DESC P2_TITLE CREATE_MODIFY_DESC MODIFY_ADMIN_TITLE RESET_PASSWORD_TITLE LOCK_ACCOUNT_TITLE REMOVE_ACCOUNT_TITLE SYSTEM_PASSWORD_DESCRIPTION