Files
chasquid/cmd/chasquid-util/test_users.cmy
Alberto Bertogli aae0367c60 Log how many things were loaded for each domain
This patch makes chasquid log how many users, aliases and DKIM keys were
loaded for each domain.

This makes it easier to confirm changes, and troubleshoot problems
related to these per-domain configuration files.
2024-05-10 12:19:49 +01:00

61 lines
1.7 KiB
Plaintext

# Tests for user management commands.
# Start with a clean slate by removing the database, which could have been
# manipulated by previous tests.
c = rm -f .config/domains/domain/users
c wait 0
c = ./chasquid-util -C=.config user-add user@domain --password=passwd
c <- Added user
c wait 0
c = ./chasquid-util -C=.config check-userdb domain
c <- Database loaded (1 users)
c wait 0
c = ./chasquid-util -C=.config user-add receive@domain --receive_only
c <- Added user
c wait 0
c = ./chasquid-util -C=.config check-userdb domain
c <- Database loaded (2 users)
c wait 0
c = ./chasquid-util -C=.config user-add xxx@domain \
--password=passwd --receive_only
c <- Cannot specify both --receive_only and --password
c wait 1
c = ./chasquid-util -C=.config authenticate user@domain --password=passwd
c <- Authentication succeeded
c wait 0
c = ./chasquid-util -C=.config authenticate user@domain --password=abcd
c <- Authentication failed
c wait 1
# Try to authenticate on the receive-only user
c = ./chasquid-util -C=.config authenticate receive@domain --password=passwd
c <- Authentication failed
c wait 1
# Remove a user, then check authentication fails.
c = ./chasquid-util -C=.config user-remove user@domain
c <- Removed user
c wait 0
c = ./chasquid-util -C=.config authenticate user@domain --password=passwd
c <- Authentication failed
c wait 1
c = ./chasquid-util -C=.config user-remove unknown@domain
c <- Unknown user
c wait 1
c = ./chasquid-util -C=.config user-add badarg
c <- Domain missing, username should be of the form 'user@domain'
c wait 1
c = ./chasquid-util -C=.config user-add "bad user@domain"
c <- Error normalizing user: precis: disallowed rune encountered
c wait 1