test: ensure minimum username length

This commit is contained in:
missytake
2024-06-27 12:28:05 +02:00
committed by holger krekel
parent 0483603d4a
commit 7c98c1f8c9

View File

@@ -12,7 +12,9 @@ from chatmaild.doveauth import (
handle_dovecot_protocol,
handle_dovecot_request,
lookup_passdb,
is_allowed_to_create,
)
from chatmaild.newemail import create_newemail_dict
def test_basic(db, example_config):
@@ -25,6 +27,13 @@ def test_basic(db, example_config):
assert data == data2
def test_invalid_username_length(example_config):
creds = create_newemail_dict(example_config)
assert not is_allowed_to_create(example_config, creds['email'][1:], creds['password'])
# for checking the max_length, we need to get it from the config
# assert not is_allowed_to_create(example_config, 'a' + creds['email'], creds['password'])
def test_dont_overwrite_password_on_wrong_login(db, example_config):
"""Test that logging in with a different password doesn't create a new user"""
res = lookup_passdb(