diff --git a/chatmaild/src/chatmaild/tests/test_doveauth.py b/chatmaild/src/chatmaild/tests/test_doveauth.py index b2649f10..1ecaa3e3 100644 --- a/chatmaild/src/chatmaild/tests/test_doveauth.py +++ b/chatmaild/src/chatmaild/tests/test_doveauth.py @@ -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(