2023-01-03 05:58:09 +00:00
|
|
|
load "${REPOSITORY_ROOT}/test/helper/setup"
|
|
|
|
load "${REPOSITORY_ROOT}/test/helper/common"
|
2022-01-03 21:03:46 +00:00
|
|
|
|
2023-01-09 07:54:04 +00:00
|
|
|
BATS_TEST_NAME_PREFIX='[DNSBLs] '
|
2023-01-03 05:58:09 +00:00
|
|
|
CONTAINER1_NAME='dms-test_dnsbl_enabled'
|
|
|
|
CONTAINER2_NAME='dms-test_dnsbl_disabled'
|
2022-05-30 00:53:30 +00:00
|
|
|
|
2023-01-03 05:58:09 +00:00
|
|
|
function setup_file() {
|
|
|
|
local CONTAINER_NAME=${CONTAINER1_NAME}
|
|
|
|
local CUSTOM_SETUP_ARGUMENTS=(
|
|
|
|
--env ENABLE_DNSBL=1
|
|
|
|
)
|
2023-01-21 23:05:28 +00:00
|
|
|
_init_with_defaults
|
|
|
|
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
|
|
|
|
_wait_for_smtp_port_in_container
|
2023-01-03 05:58:09 +00:00
|
|
|
|
|
|
|
local CONTAINER_NAME=${CONTAINER2_NAME}
|
|
|
|
local CUSTOM_SETUP_ARGUMENTS=(
|
|
|
|
--env ENABLE_DNSBL=0
|
|
|
|
)
|
2023-01-21 23:05:28 +00:00
|
|
|
_init_with_defaults
|
|
|
|
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
|
|
|
|
_wait_for_smtp_port_in_container
|
2023-01-03 05:58:09 +00:00
|
|
|
}
|
2022-05-30 00:53:30 +00:00
|
|
|
|
2023-01-03 05:58:09 +00:00
|
|
|
function teardown_file() {
|
|
|
|
docker rm -f "${CONTAINER1_NAME}" "${CONTAINER2_NAME}"
|
2022-01-03 21:03:46 +00:00
|
|
|
}
|
|
|
|
|
2023-01-09 07:54:04 +00:00
|
|
|
@test "(enabled) Postscreen DNS block lists -> postscreen_dnsbl_action" {
|
2023-01-21 23:05:28 +00:00
|
|
|
_run_in_container_explicit "${CONTAINER1_NAME}" postconf postscreen_dnsbl_action
|
2022-01-03 21:03:46 +00:00
|
|
|
assert_output 'postscreen_dnsbl_action = enforce'
|
|
|
|
}
|
|
|
|
|
2023-01-09 07:54:04 +00:00
|
|
|
@test "(enabled) Postscreen DNS block lists -> postscreen_dnsbl_sites" {
|
2023-01-21 23:05:28 +00:00
|
|
|
_run_in_container_explicit "${CONTAINER1_NAME}" postconf postscreen_dnsbl_sites
|
2023-02-10 23:24:09 +00:00
|
|
|
assert_output --regexp '^postscreen_dnsbl_sites = [a-zA-Z0-9]+'
|
2022-01-03 21:03:46 +00:00
|
|
|
}
|
|
|
|
|
2023-01-09 07:54:04 +00:00
|
|
|
@test "(disabled) Postscreen DNS block lists -> postscreen_dnsbl_action" {
|
2023-01-21 23:05:28 +00:00
|
|
|
_run_in_container_explicit "${CONTAINER2_NAME}" postconf postscreen_dnsbl_action
|
2022-01-03 21:03:46 +00:00
|
|
|
assert_output 'postscreen_dnsbl_action = ignore'
|
|
|
|
}
|
|
|
|
|
2023-01-09 07:54:04 +00:00
|
|
|
@test "(disabled) Postscreen DNS block lists -> postscreen_dnsbl_sites" {
|
2023-01-21 23:05:28 +00:00
|
|
|
_run_in_container_explicit "${CONTAINER2_NAME}" postconf postscreen_dnsbl_sites
|
2022-01-03 21:03:46 +00:00
|
|
|
assert_output 'postscreen_dnsbl_sites ='
|
|
|
|
}
|