Difference between revisions of "Esmith::FormMagick::Tester"
(2 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
=== SYNOPSIS === | === SYNOPSIS === | ||
use esmith::FormMagick::Tester; | use esmith::FormMagick::Tester; | ||
− | + | ||
my $agent = esmith::FormMagick::Tester->new( | my $agent = esmith::FormMagick::Tester->new( | ||
password => $admin_password, | password => $admin_password, | ||
host => $hostname_or_ip, | host => $hostname_or_ip, | ||
); | ); | ||
− | + | ||
$agent->get_panel($panel); # eg ’useraccounts’ | $agent->get_panel($panel); # eg ’useraccounts’ | ||
− | + | ||
$agent->set_language(’en’); | $agent->set_language(’en’); | ||
$agent->set_language([’fr’, ’en’]); | $agent->set_language([’fr’, ’en’]); | ||
Line 54: | Line 54: | ||
[http://wiki.contribs.org/CGI::FormMagick CGI::FormMagick] | [http://wiki.contribs.org/CGI::FormMagick CGI::FormMagick] | ||
[http://wiki.contribs.org/Esmith::FormMagick Esmith::FormMagick] | [http://wiki.contribs.org/Esmith::FormMagick Esmith::FormMagick] | ||
− | + | ||
[[Category:SME Server Development Framework]] | [[Category:SME Server Development Framework]] | ||
[[Category:Development Tools]] | [[Category:Development Tools]] | ||
− |
Latest revision as of 12:03, 1 February 2014
NAME
esmith::FormMagick::Tester - test esmith FormMagick applications
In a root terminal you can do the command below if you want to display the up-to-date content
perldoc esmith::FormMagick::Tester
SYNOPSIS
use esmith::FormMagick::Tester; my $agent = esmith::FormMagick::Tester->new( password => $admin_password, host => $hostname_or_ip, ); $agent->get_panel($panel); # eg ’useraccounts’ $agent->set_language(’en’); $agent->set_language([’fr’, ’en’]);
DESCRIPTION
esmith::FormMagick::Tester is a subclass of WWW::Automate, which is in turn a subclass of LWP::UserAgent. Read the documentation for WWW::Automate to get a better idea of how to use it effectively.
new($admin_password)
Create a new agent for testing esmith FormMagick applications (specifically, the web manager). It takes a hash of arguments, which include:
password administrative password for the manager (defaults to "default") host hostname or IP to test against (defaults to localhost)
$agent->get_panel($panel)
Gets a panel from the web manager, calling WWW::Automate::get with a URL built from $agent->{host} and the name of the panel you supply.
$agent->set_language($lang)
Sets the language to use. This sets an the HTTP_ACCEPT_LANGUAGE header sent by the client to the server manager. You may provide it with a single language, eg. "en", or with a reference to a list of languages, eg. [ qw(en de fr) ]
Sets $agent->{language} as a side effect, in case you want it for anything later.
mode($script)
This convenience function is exported for use in testing scripts. For instance:
use esmith::FormMagick::Tester; is(mode(’useraccounts’, 4755, "Setuid and executable");
INTERNAL METHODS
The following methods are used internally by this module.
get_basic_credentials()
Returns the administrative login/password for the esmith manager.
SEE ALSO
CGI::FormMagick Esmith::FormMagick