1 package Support::TestSetup;
6 use CGI qw( -no_xhtml);
14 use SL::InstanceConfiguration;
18 my ($client, $login) = @_;
20 die 'need client and login' unless $client && $login;
24 $::lxdebug = LXDebug->new(target => LXDebug::STDERR_TARGET);
25 $::lxdebug->disable_sub_tracing;
26 $::locale = Locale->new($::lx_office_conf{system}->{language});
28 $::auth = SL::Auth->new;
29 die "Cannot find client with ID or name '$client'" if !$::auth->set_client($client);
31 $::instance_conf = SL::InstanceConfiguration->new;
32 $::request = SL::Request->new( cgi => CGI->new({}), layout => SL::Layout::None->new );
34 die 'cannot reach auth db' unless $::auth->session_tables_present;
36 $::auth->restore_session;
38 require "bin/mozilla/common.pl";
40 die "cannot find user $login" unless %::myconfig = $::auth->read_user(login => $login);
42 $::form->{login} = $login; # normaly implicit at login
44 die "cannot find locale for user $login" unless $::locale = Locale->new($::myconfig{countrycode});
46 $::instance_conf->init;
52 SL::LxOfficeConf->read;
54 my $login = shift || $::lx_office_conf{testing}{login} || 'demo';
55 my $client = shift || $::lx_office_conf{testing}{client} || '';
56 _login($client, $login);