Debian Codegraph @

debian/tests/common-log-test

raw
1 #!/bin/sh
2
3 set -e
4
5 test_apache_common_ipv4_log () {
6 log_entry='127.0.0.1 - - [24/Aug/2022:21:08:32 +0200] "GET / HTTP/1.1" 200 11012 "-" "Wget/1.21"'
7 anon_log_entry='127.0.0.0 - - [24/Aug/2022:21:08:32 +0200] "GET / HTTP/1.1" 200 11012 "-" "Wget/1.21"'
8 output=$( echo "$log_entry" | anonip )
9 assertEquals "$output" "$anon_log_entry"
10 }
11
12 test_apache_common_ipv6_log () {
13 log_entry='::1 - - [24/Aug/2022:21:07:04 +0200] "GET / HTTP/1.1" 200 11012 "-" "Wget/1.21"'
14 anon_log_entry=':: - - [24/Aug/2022:21:07:04 +0200] "GET / HTTP/1.1" 200 11012 "-" "Wget/1.21"'
15 output=$( echo "$log_entry" | anonip )
16 assertEquals "$output" "$anon_log_entry"
17 }
18
19 test_nginx_default_ipv4_log () {
20 log_entry='127.0.0.1 - - [24/Aug/2022:21:12:43 +0200] "GET / HTTP/1.1" 200 612 "-" "Wget/1.21"'
21 anon_log_entry='127.0.0.0 - - [24/Aug/2022:21:12:43 +0200] "GET / HTTP/1.1" 200 612 "-" "Wget/1.21"'
22 output=$( echo "$log_entry" | anonip )
23 assertEquals "$output" "$anon_log_entry"
24 }
25
26 test_nginx_default_ipv6_log () {
27 log_entry='::1 - - [24/Aug/2022:21:11:31 +0200] "GET / HTTP/1.1" 200 612 "-" "Wget/1.21"'
28 anon_log_entry=':: - - [24/Aug/2022:21:11:31 +0200] "GET / HTTP/1.1" 200 612 "-" "Wget/1.21"'
29 output=$( echo "$log_entry" | anonip )
30 assertEquals "$output" "$anon_log_entry"
31 }
32
33 . shunit2
34