remove superflous auth files & shorten IMAP tests

This commit is contained in:
georglauterbach 2024-01-02 00:39:34 +01:00
parent aa6d0c5071
commit 2a477bfdd4
No known key found for this signature in database
GPG Key ID: F367F7C43C118578
11 changed files with 39 additions and 54 deletions

View File

@ -1,4 +0,0 @@
EHLO mail
AUTH LOGIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWlu
Bn3JKisq4HQ2RO==
QUIT

View File

@ -1,4 +0,0 @@
EHLO mail
AUTH LOGIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWlu
bXlwYXNzd29yZA==
QUIT

View File

@ -1,3 +0,0 @@
EHLO mail
AUTH PLAIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWluAGFkZGVkQGxvY2FsaG9zdC5sb2NhbGRvbWFpbgBCQURQQVNTV09SRA==
QUIT

View File

@ -1,3 +0,0 @@
EHLO mail
AUTH PLAIN YWRkZWRAbG9jYWxob3N0LmxvY2FsZG9tYWluAGFkZGVkQGxvY2FsaG9zdC5sb2NhbGRvbWFpbgBteXBhc3N3b3Jk
QUIT

View File

@ -1,5 +0,0 @@
EHLO mail
AUTH LOGIN
c29tZS51c2VyQGxvY2FsaG9zdC5sb2NhbGRvbWFpbg==
c2VjcmV0
QUIT

View File

@ -1,4 +0,0 @@
EHLO mail
AUTH LOGIN dXNlcjFAbG9jYWxob3N0LmxvY2FsZG9tYWlu
Bn3JKisq4HQ2RO==
QUIT

View File

@ -1,4 +0,0 @@
EHLO mail
AUTH LOGIN dXNlcjFAbG9jYWxob3N0LmxvY2FsZG9tYWlu
bXlwYXNzd29yZA==
QUIT

View File

@ -1,3 +0,0 @@
EHLO mail
AUTH PLAIN WRONGPASSWORD
QUIT

View File

@ -1,3 +0,0 @@
EHLO mail
AUTH PLAIN dXNlcjFAbG9jYWxob3N0LmxvY2FsZG9tYWluAHVzZXIxQGxvY2FsaG9zdC5sb2NhbGRvbWFpbgBteXBhc3N3b3Jk
QUIT

View File

@ -101,6 +101,19 @@ function setup_file() {
assert_success
}
function _unsuccessful() {
_send_email --port 465 --auth "${1}" --auth-user "${2}" --auth-password wrongpassword
assert_failure
assert_output --partial 'authentication failed'
assert_output --partial 'No authentication type succeeded'
}
function _successful() {
_send_email --port 465 --auth "${1}" --auth-user "${2}" --auth-password mypassword --quit-after AUTH
assert_success
assert_output --partial 'Authentication successful'
}
@test "should succeed at emptying mail queue" {
# Try catch errors preventing emptying the queue ahead of waiting:
_run_in_container mailq
@ -111,44 +124,35 @@ function setup_file() {
}
@test "should successfully authenticate with good password (plain)" {
_nc_wrapper 'auth/smtp-auth-plain.txt' '-w 5 0.0.0.0 465'
assert_output --partial 'Authentication successful'
_successful PLAIN user1@localhost.localdomain
}
@test "should fail to authenticate with wrong password (plain)" {
_nc_wrapper 'auth/smtp-auth-plain-wrong.txt' '-w 20 0.0.0.0 465'
assert_output --partial 'authentication failed'
_unsuccessful PLAIN user1@localhost.localdomain
}
@test "should successfully authenticate with good password (login)" {
_nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 465'
assert_output --partial 'Authentication successful'
_successful LOGIN user1@localhost.localdomain
}
@test "should fail to authenticate with wrong password (login)" {
_nc_wrapper 'auth/smtp-auth-login-wrong.txt' '-w 20 0.0.0.0 465'
assert_output --partial 'authentication failed'
_unsuccessful LOGIN user1@localhost.localdomain
}
@test "[user: 'added'] should successfully authenticate with good password (plain)" {
_nc_wrapper 'auth/added-smtp-auth-plain.txt' '-w 5 0.0.0.0 465'
assert_output --partial 'Authentication successful'
_successful PLAIN added@localhost.localdomain
}
@test "[user: 'added'] should fail to authenticate with wrong password (plain)" {
_nc_wrapper 'auth/added-smtp-auth-plain-wrong.txt' '-w 20 0.0.0.0 465'
assert_output --partial 'authentication failed'
_unsuccessful PLAIN added@localhost.localdomain
}
@test "[user: 'added'] should successfully authenticate with good password (login)" {
_nc_wrapper 'auth/added-smtp-auth-login.txt' '-w 5 0.0.0.0 465'
assert_success
assert_output --partial 'Authentication successful'
_successful LOGIN added@localhost.localdomain
}
@test "[user: 'added'] should fail to authenticate with wrong password (login)" {
_nc_wrapper 'auth/added-smtp-auth-login-wrong.txt' '-w 20 0.0.0.0 465'
assert_output --partial 'authentication failed'
_unsuccessful LOGIN added@localhost.localdomain
}
# TODO: Add a test covering case SPAMASSASSIN_SPAM_TO_INBOX=1 (default)

View File

@ -31,15 +31,29 @@ function teardown_file() { _default_teardown ; }
}
@test '(SASLauthd) RIMAP SMTP authentication works' {
_nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 25'
assert_output --partial 'Error: authentication not enabled'
_send_email \
--auth LOGIN \
--auth-user user1@localhost.localdomain \
--auth-password mypassword \
--quit-after AUTH
assert_failure
assert_output --partial 'Host did not advertise authentication'
_nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 465'
_send_email \
--port 465 \
--auth LOGIN \
--auth-user user1@localhost.localdomain \
--auth-password mypassword \
--quit-after AUTH
assert_success
assert_output --partial 'Authentication successful'
_nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 587'
_send_email \
--port 587 \
--auth LOGIN \
--auth-user user1@localhost.localdomain \
--auth-password mypassword \
--quit-after AUTH
assert_success
assert_output --partial 'Authentication successful'
}