Jan Dittberner
5db6223bc0
- generate domains app - duplicate managemails.models.MailDomain as domains.models.MailDomain - add domains app to gnuviechadmin.settings.base.LOCAL_APPS - repair managemails.tests.test_models - fix handling of empty results in osusers.models.GroupManager.get_next_gid and osusers.models.UserManager.get_next_uid
31 lines
872 B
Python
31 lines
872 B
Python
from django.test import TestCase
|
|
from passlib.hash import sha512_crypt
|
|
|
|
from osusers.models import User
|
|
from managemails.models import (
|
|
MailAddress,
|
|
MailDomain,
|
|
Mailbox,
|
|
)
|
|
|
|
|
|
class MailDomainTest(TestCase):
|
|
def test__str__(self):
|
|
md = MailDomain.objects.create(domain='example.org')
|
|
self.assertEqual(str(md), 'example.org')
|
|
|
|
|
|
class MailboxTest(TestCase):
|
|
def test_set_password(self):
|
|
user = User.objects.create_user()
|
|
mb = Mailbox.objects.create(username='test', osuser=user)
|
|
mb.set_password('test')
|
|
self.assertTrue(sha512_crypt.verify('test', mb.password))
|
|
|
|
|
|
class MailAddressTest(TestCase):
|
|
def test__str__(self):
|
|
md = MailDomain.objects.create(domain='example.org')
|
|
ma = MailAddress.objects.create(localpart='test', domain=md)
|
|
self.assertEqual(str(ma), 'test@example.org')
|