Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# This test is db dependent: SIPServer needs MsgType which needs Auth. |
4 |
# And Auth needs config vars and prefences in its BEGIN block. |
5 |
|
6 |
# This file is part of Koha. |
7 |
# |
8 |
# Koha is free software; you can redistribute it and/or modify it |
9 |
# under the terms of the GNU General Public License as published by |
10 |
# the Free Software Foundation; either version 3 of the License, or |
11 |
# (at your option) any later version. |
12 |
# |
13 |
# Koha is distributed in the hope that it will be useful, but |
14 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
# GNU General Public License for more details. |
17 |
# |
18 |
# You should have received a copy of the GNU General Public License |
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
20 |
|
21 |
use Modern::Perl; |
22 |
|
23 |
use Test::More tests => 1; |
24 |
|
25 |
use C4::SIP::Sip; |
26 |
|
27 |
subtest 'remove_password_from_message' => sub { |
28 |
plan tests => 8; |
29 |
|
30 |
is( C4::SIP::Sip::remove_password_from_message( "INPUT MSG: '9300CNterm1|COterm1|CPCPL|'" ), |
31 |
"INPUT MSG: '9300CNterm1|CO***|CPCPL|'", "93 Login - password" ); |
32 |
|
33 |
is( C4::SIP::Sip::remove_password_from_message( "INPUT MSG: '9300CNterm1|COt|CPCPL|'" ), |
34 |
"INPUT MSG: '9300CNterm1|CO***|CPCPL|'", "93 Login - short password" ); |
35 |
|
36 |
is( C4::SIP::Sip::remove_password_from_message( "INPUT MSG: '9300CNterm1|CO%&/()=+qwerty123456|CPCPL|'" ), |
37 |
"INPUT MSG: '9300CNterm1|CO***|CPCPL|'", "93 Login - Complex password" ); |
38 |
|
39 |
is( C4::SIP::Sip::remove_password_from_message( "INPUT MSG: '9300CNterm1|CO1234|CPCPL|'" ), |
40 |
"INPUT MSG: '9300CNterm1|CO***|CPCPL|'", "93 Login - PIN" ); |
41 |
|
42 |
is( C4::SIP::Sip::remove_password_from_message( "11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC1234|AD1234|BON" ), |
43 |
'11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC***|AD***|BON', "11 Checkout" ); |
44 |
|
45 |
is( C4::SIP::Sip::remove_password_from_message( "11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC|AD1234|BON" ), |
46 |
'11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC***|AD***|BON', "11 Checkout - empty AC" ); |
47 |
|
48 |
is( C4::SIP::Sip::remove_password_from_message( "11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC1234|AD|BON" ), |
49 |
'11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC***|AD***|BON', "11 Checkout - empty AD" ); |
50 |
|
51 |
is( C4::SIP::Sip::remove_password_from_message( "11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC|AD|BON" ), |
52 |
'11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC***|AD***|BON', "11 Checkout - empty AC and AND" ); |
53 |
}; |