mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 20:38:05 +00:00
test: ensure minimum username length
This commit is contained in:
@@ -12,7 +12,9 @@ from chatmaild.doveauth import (
|
|||||||
handle_dovecot_protocol,
|
handle_dovecot_protocol,
|
||||||
handle_dovecot_request,
|
handle_dovecot_request,
|
||||||
lookup_passdb,
|
lookup_passdb,
|
||||||
|
is_allowed_to_create,
|
||||||
)
|
)
|
||||||
|
from chatmaild.newemail import create_newemail_dict
|
||||||
|
|
||||||
|
|
||||||
def test_basic(db, example_config):
|
def test_basic(db, example_config):
|
||||||
@@ -25,6 +27,13 @@ def test_basic(db, example_config):
|
|||||||
assert data == data2
|
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):
|
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"""
|
"""Test that logging in with a different password doesn't create a new user"""
|
||||||
res = lookup_passdb(
|
res = lookup_passdb(
|
||||||
|
|||||||
Reference in New Issue
Block a user