Lines 93-99
subtest "GetLogs should return all logs if dates are not set" => sub {
Link Here
|
93 |
|
93 |
|
94 |
subtest 'logaction(): interface is correctly logged' => sub { |
94 |
subtest 'logaction(): interface is correctly logged' => sub { |
95 |
|
95 |
|
96 |
plan tests => 4; |
96 |
plan tests => 5; |
97 |
|
97 |
|
98 |
# No interface passed, using C4::Context->interface |
98 |
# No interface passed, using C4::Context->interface |
99 |
$dbh->do("DELETE FROM action_logs;"); |
99 |
$dbh->do("DELETE FROM action_logs;"); |
Lines 123-134
subtest 'logaction(): interface is correctly logged' => sub {
Link Here
|
123 |
$logs = GetLogs(); |
123 |
$logs = GetLogs(); |
124 |
is( @{$logs}[0]->{ interface }, 'sip', 'Passed interface is respected (sip)'); |
124 |
is( @{$logs}[0]->{ interface }, 'sip', 'Passed interface is respected (sip)'); |
125 |
|
125 |
|
|
|
126 |
# Explicit interfaces |
127 |
$dbh->do("DELETE FROM action_logs;"); |
128 |
C4::Context->interface( 'rest' ); |
129 |
logaction( "MEMBERS", "MODIFY", 1, 'test info', 'rest'); |
130 |
$logs = GetLogs(); |
131 |
is( @{$logs}[0]->{ interface }, 'rest', 'Passed interface is respected (rest)'); |
132 |
|
126 |
$dbh->rollback; |
133 |
$dbh->rollback; |
127 |
}; |
134 |
}; |
128 |
|
135 |
|
129 |
subtest 'GetLogs() respects interface filters' => sub { |
136 |
subtest 'GetLogs() respects interface filters' => sub { |
130 |
|
137 |
|
131 |
plan tests => 5; |
138 |
plan tests => 6; |
132 |
|
139 |
|
133 |
$dbh->do("DELETE FROM action_logs;"); |
140 |
$dbh->do("DELETE FROM action_logs;"); |
134 |
|
141 |
|
Lines 136-144
subtest 'GetLogs() respects interface filters' => sub {
Link Here
|
136 |
logaction( 'MEMBERS', 'MODIFY', 1, 'sip info', 'sip'); |
143 |
logaction( 'MEMBERS', 'MODIFY', 1, 'sip info', 'sip'); |
137 |
logaction( 'MEMBERS', 'MODIFY', 1, 'intranet info', 'intranet'); |
144 |
logaction( 'MEMBERS', 'MODIFY', 1, 'intranet info', 'intranet'); |
138 |
logaction( 'MEMBERS', 'MODIFY', 1, 'commandline info', 'commandline'); |
145 |
logaction( 'MEMBERS', 'MODIFY', 1, 'commandline info', 'commandline'); |
|
|
146 |
logaction( 'MEMBERS', 'MODIFY', 1, 'rest info', 'rest'); |
139 |
|
147 |
|
140 |
my $logs = scalar @{ GetLogs() }; |
148 |
my $logs = scalar @{ GetLogs() }; |
141 |
is( $logs, 4, 'If no filter on interfaces is passed, all logs are returned'); |
149 |
is( $logs, 5, 'If no filter on interfaces is passed, all logs are returned'); |
142 |
|
150 |
|
143 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['opac']); |
151 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['opac']); |
144 |
is( @{$logs}[0]->{ interface }, 'opac', 'Interface correctly filtered (opac)'); |
152 |
is( @{$logs}[0]->{ interface }, 'opac', 'Interface correctly filtered (opac)'); |
Lines 152-157
subtest 'GetLogs() respects interface filters' => sub {
Link Here
|
152 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['commandline']); |
160 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['commandline']); |
153 |
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); |
161 |
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); |
154 |
|
162 |
|
|
|
163 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['rest']); |
164 |
is( @{$logs}[0]->{ interface }, 'rest', 'Interface correctly filtered (rest)'); |
165 |
|
155 |
$dbh->rollback; |
166 |
$dbh->rollback; |
156 |
}; |
167 |
}; |
157 |
|
168 |
|
158 |
- |
|
|