Difference between revisions of "Esmith::FormMagick::Tester"

From SME Server
Jump to navigationJump to search
(Created page with "=== 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 cont...")
(No difference)

Revision as of 01:25, 20 December 2013

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