<commit_before># Test rspamd gtube using scan file feature

. ${TEST_DIRNAME}/functions.sh

export RSPAMD_CONFIG="$TEST_DIRNAME/configs/trivial.conf"
run_rspamd
run perl "$TEST_DIRNAME/cases/scan_file.pl" "$TEST_DIRNAME/messages/gtube.eml"
check_output 'GTUBE'

run perl "$TEST_DIRNAME/cases/scan_file.pl" "file=$TEST_DIRNAME/messages/gtube.eml"
check_output 'GTUBE'

run perl "$TEST_DIRNAME/cases/scan_file.pl" "path=$TEST_DIRNAME/messages/gtube.eml"
check_output 'GTUBE'<commit_msg>Add url encoded tests.<commit_after># Test rspamd gtube using scan file feature

. ${TEST_DIRNAME}/functions.sh

export RSPAMD_CONFIG="$TEST_DIRNAME/configs/trivial.conf"
run_rspamd
run perl "$TEST_DIRNAME/cases/scan_file.pl" "$TEST_DIRNAME/messages/gtube.eml"
check_output 'GTUBE'

run perl "$TEST_DIRNAME/cases/scan_file.pl" "file=$TEST_DIRNAME/messages/gtube.eml"
check_output 'GTUBE'

run perl "$TEST_DIRNAME/cases/scan_file.pl" "path=$TEST_DIRNAME/messages/gtube.eml"
check_output 'GTUBE'

# Hex encode every character
_hex_name=`printf "$TEST_DIRNAME/messages/gtube.eml" | hexdump -v -e '/1 "%02x"' | sed 's/\(..\)/%\1/g'`
run perl "$TEST_DIRNAME/cases/scan_file.pl" "${_hex_name}"
check_output 'GTUBE'

run perl "$TEST_DIRNAME/cases/scan_file.pl" "file=${_hex_name}"
check_output 'GTUBE'
{'fraction_non_alphanumeric': 0.1431924882629108, 'fraction_numerical': 0.003129890453834116, 'mean_word_length': 6.47953216374269, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5305937', 'n_tokens_mistral': 513, 'n_tokens_neox': 501, 'n_words': 87}