docker-mailserver/test/tests/parallel/set3/mta/privacy.bats
Georg Lauterbach 9e81517fe3
tests: Use swaks instead of nc for sending mail (#3732)
See associated `CHANGELOG.md` entry for details.

---------

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2024-01-03 13:17:54 +13:00

43 lines
1.2 KiB
Bash

load "${REPOSITORY_ROOT}/test/helper/setup"
load "${REPOSITORY_ROOT}/test/helper/common"
BATS_TEST_NAME_PREFIX='[Privacy] '
CONTAINER_NAME='dms-test_privacy'
function setup_file() {
_init_with_defaults
local CUSTOM_SETUP_ARGUMENTS=(
--env ENABLE_AMAVIS=1
--env ENABLE_MANAGESIEVE=1
--env PERMIT_DOCKER=host
--env SSL_TYPE='snakeoil'
)
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
# Port 10024 (Amavis)
_wait_for_tcp_port_in_container 10024
_wait_for_smtp_port_in_container
}
function teardown_file() { _default_teardown ; }
# this test covers https://github.com/docker-mailserver/docker-mailserver/issues/681
@test "(Postfix) remove privacy details of the sender" {
_send_email \
--port 587 -tls --auth LOGIN \
--auth-user user1@localhost.localdomain \
--auth-password mypassword \
--data 'privacy'
assert_success
_run_until_success_or_timeout 120 _exec_in_container_bash '[[ -d /var/mail/localhost.localdomain/user1/new ]]'
assert_success
_count_files_in_directory_in_container '/var/mail/localhost.localdomain/user1/new/' '1'
_run_in_container_bash 'grep -rE "^User-Agent:" /var/mail/localhost.localdomain/user1/new'
_should_output_number_of_lines 0
}