Lines 125-134
subtest 'logaction(): interface is correctly logged' => sub {
Link Here
|
125 |
|
125 |
|
126 |
# Explicit interfaces |
126 |
# Explicit interfaces |
127 |
$dbh->do("DELETE FROM action_logs;"); |
127 |
$dbh->do("DELETE FROM action_logs;"); |
128 |
C4::Context->interface( 'rest' ); |
128 |
C4::Context->interface( 'api' ); |
129 |
logaction( "MEMBERS", "MODIFY", 1, 'test info', 'rest'); |
129 |
logaction( "MEMBERS", "MODIFY", 1, 'test info', 'api'); |
130 |
$logs = GetLogs(); |
130 |
$logs = GetLogs(); |
131 |
is( @{$logs}[0]->{ interface }, 'rest', 'Passed interface is respected (rest)'); |
131 |
is( @{$logs}[0]->{ interface }, 'api', 'Passed interface is respected (api)'); |
132 |
|
132 |
|
133 |
}; |
133 |
}; |
134 |
|
134 |
|
Lines 142-148
subtest 'GetLogs() respects interface filters' => sub {
Link Here
|
142 |
logaction( 'MEMBERS', 'MODIFY', 1, 'sip info', 'sip'); |
142 |
logaction( 'MEMBERS', 'MODIFY', 1, 'sip info', 'sip'); |
143 |
logaction( 'MEMBERS', 'MODIFY', 1, 'intranet info', 'intranet'); |
143 |
logaction( 'MEMBERS', 'MODIFY', 1, 'intranet info', 'intranet'); |
144 |
logaction( 'MEMBERS', 'MODIFY', 1, 'commandline info', 'commandline'); |
144 |
logaction( 'MEMBERS', 'MODIFY', 1, 'commandline info', 'commandline'); |
145 |
logaction( 'MEMBERS', 'MODIFY', 1, 'rest info', 'rest'); |
145 |
logaction( 'MEMBERS', 'MODIFY', 1, 'api info', 'api'); |
146 |
|
146 |
|
147 |
my $logs = scalar @{ GetLogs() }; |
147 |
my $logs = scalar @{ GetLogs() }; |
148 |
is( $logs, 5, 'If no filter on interfaces is passed, all logs are returned'); |
148 |
is( $logs, 5, 'If no filter on interfaces is passed, all logs are returned'); |
Lines 159-166
subtest 'GetLogs() respects interface filters' => sub {
Link Here
|
159 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['commandline']); |
159 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['commandline']); |
160 |
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); |
160 |
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); |
161 |
|
161 |
|
162 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['rest']); |
162 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['api']); |
163 |
is( @{$logs}[0]->{ interface }, 'rest', 'Interface correctly filtered (rest)'); |
163 |
is( @{$logs}[0]->{ interface }, 'api', 'Interface correctly filtered (api)'); |
164 |
|
164 |
|
165 |
}; |
165 |
}; |
166 |
|
166 |
|
167 |
- |
|
|