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 122-132
subtest 'logaction(): interface is correctly logged' => sub {
Link Here
|
122 |
logaction( "MEMBERS", "MODIFY", 1, 'test info', 'sip'); |
122 |
logaction( "MEMBERS", "MODIFY", 1, 'test info', 'sip'); |
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 |
|
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 |
|
125 |
}; |
133 |
}; |
126 |
|
134 |
|
127 |
subtest 'GetLogs() respects interface filters' => sub { |
135 |
subtest 'GetLogs() respects interface filters' => sub { |
128 |
|
136 |
|
129 |
plan tests => 5; |
137 |
plan tests => 6; |
130 |
|
138 |
|
131 |
$dbh->do("DELETE FROM action_logs;"); |
139 |
$dbh->do("DELETE FROM action_logs;"); |
132 |
|
140 |
|
Lines 134-142
subtest 'GetLogs() respects interface filters' => sub {
Link Here
|
134 |
logaction( 'MEMBERS', 'MODIFY', 1, 'sip info', 'sip'); |
142 |
logaction( 'MEMBERS', 'MODIFY', 1, 'sip info', 'sip'); |
135 |
logaction( 'MEMBERS', 'MODIFY', 1, 'intranet info', 'intranet'); |
143 |
logaction( 'MEMBERS', 'MODIFY', 1, 'intranet info', 'intranet'); |
136 |
logaction( 'MEMBERS', 'MODIFY', 1, 'commandline info', 'commandline'); |
144 |
logaction( 'MEMBERS', 'MODIFY', 1, 'commandline info', 'commandline'); |
|
|
145 |
logaction( 'MEMBERS', 'MODIFY', 1, 'rest info', 'rest'); |
137 |
|
146 |
|
138 |
my $logs = scalar @{ GetLogs() }; |
147 |
my $logs = scalar @{ GetLogs() }; |
139 |
is( $logs, 4, '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'); |
140 |
|
149 |
|
141 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['opac']); |
150 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['opac']); |
142 |
is( @{$logs}[0]->{ interface }, 'opac', 'Interface correctly filtered (opac)'); |
151 |
is( @{$logs}[0]->{ interface }, 'opac', 'Interface correctly filtered (opac)'); |
Lines 149-154
subtest 'GetLogs() respects interface filters' => sub {
Link Here
|
149 |
|
158 |
|
150 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['commandline']); |
159 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['commandline']); |
151 |
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); |
160 |
is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); |
|
|
161 |
|
162 |
$logs = GetLogs(undef,undef,undef,undef,undef,undef,undef,['rest']); |
163 |
is( @{$logs}[0]->{ interface }, 'rest', 'Interface correctly filtered (rest)'); |
164 |
|
152 |
}; |
165 |
}; |
153 |
|
166 |
|
154 |
$schema->storage->txn_rollback; |
167 |
$schema->storage->txn_rollback; |
155 |
- |
|
|