Revision 1d64d7e5
Von Sven Schöling vor etwa 13 Jahren hinzugefügt
config/lx_office.conf.default | ||
---|---|---|
178 | 178 |
# to the lx-office log will be put here if triggered from the console |
179 | 179 |
log_file = /tmp/lxoffice_console_debug.log |
180 | 180 |
|
181 |
[testing] |
|
182 |
|
|
183 |
# autologin to use if none is given |
|
184 |
login = demo |
|
185 |
|
|
181 | 186 |
[debug] |
182 | 187 |
# Use DBIx::Log4perl for logging DBI calls. The string LXDEBUGFILE |
183 | 188 |
# will be replaced by the file name configured for $::lxdebug. |
t/Support/TestSetup.pm | ||
---|---|---|
1 |
package Support::TestSetup; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use Data::Dumper; |
|
6 |
use CGI qw( -no_xhtml); |
|
7 |
use SL::Auth; |
|
8 |
use SL::Form; |
|
9 |
use SL::Locale; |
|
10 |
use SL::LXDebug; |
|
11 |
use Data::Dumper; |
|
12 |
use SL::LxOfficeConf; |
|
13 |
use SL::InstanceConfiguration; |
|
14 |
SL::LxOfficeConf->read; |
|
15 |
|
|
16 |
sub _login { |
|
17 |
my $login = shift; |
|
18 |
|
|
19 |
die 'need login' unless $login; |
|
20 |
|
|
21 |
package main; |
|
22 |
|
|
23 |
$::lxdebug = LXDebug->new(file => \*STDERR); |
|
24 |
$::locale = Locale->new($::lx_office_conf{system}->{language}); |
|
25 |
$::form = Form->new; |
|
26 |
$::auth = SL::Auth->new; |
|
27 |
$::instance_conf = SL::InstanceConfiguration->new; |
|
28 |
$::request = { cgi => CGI->new({}) }; |
|
29 |
|
|
30 |
die 'cannot reach auth db' unless $::auth->session_tables_present; |
|
31 |
|
|
32 |
$::auth->restore_session; |
|
33 |
|
|
34 |
require "bin/mozilla/common.pl"; |
|
35 |
|
|
36 |
die "cannot find user $login" unless %::myconfig = $::auth->read_user($login); |
|
37 |
|
|
38 |
$::form->{login} = $login; # normaly implicit at login |
|
39 |
|
|
40 |
die "cannot find locale for user $login" unless $::locale = Locale->new($::myconfig{countrycode}); |
|
41 |
|
|
42 |
$::instance_conf->init; |
|
43 |
|
|
44 |
return 1; |
|
45 |
} |
|
46 |
|
|
47 |
sub login { |
|
48 |
my $login = shift || $::lx_office_conf{testing}{login} || 'demo'; |
|
49 |
_login($login); |
|
50 |
} |
|
51 |
|
|
52 |
1; |
Auch abrufbar als: Unified diff
Loginmechanismus für Testscripte