Esmith::FormMagick::Tester

From SME Server
Revision as of 12:03, 1 February 2014 by Stephdl (talk | contribs) (→‎SEE ALSO)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
PythonIcon.png Skill level: developer
Risk of inconsistencies with Koozali SME Server methodology, upgrades & functionality is high. One must be knowledgeable about how changes impact their Koozali SME Server. Significant risk of irreversible harm.


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