🗃️(models) add MailDomain, MailDomainAccess and Mailbox models

Additional app and models to handle email addresses creation in Desk.
This commit is contained in:
Marie PUPO JEAMMET
2024-04-08 21:29:26 +02:00
committed by Marie
parent a1f9cf0854
commit cca6c77f00
11 changed files with 383 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
"""
Unit tests for the MailDomain model
"""
from django.core.exceptions import ValidationError
import pytest
from mailbox_manager import factories
pytestmark = pytest.mark.django_db
# NAME FIELD
def test_models_mail_domain__domain_name_should_not_be_empty():
"""The domain name field should not be empty."""
with pytest.raises(ValidationError, match="This field cannot be blank"):
factories.MailDomainFactory(name="")
def test_models_mail_domain__domain_name_should_not_be_null():
"""The domain name field should not be null."""
with pytest.raises(ValidationError, match="This field cannot be null."):
factories.MailDomainFactory(name=None)