add test for managemails.models.Mailbox.__str__

This commit is contained in:
Jan Dittberner 2014-06-01 18:29:41 +02:00
parent 3407a5ed24
commit 32de6257d3

View file

@ -1,14 +1,22 @@
from django.test import TestCase
from django.test.utils import override_settings
from passlib.hash import sha512_crypt
from domains.models import MailDomain
from osusers.models import User
from managemails.models import (
MailAddress,
Mailbox,
)
@override_settings(
CELERY_ALWAYS_EAGER=True,
CELERY_CACHE_BACKEND='memory',
BROKER_BACKEND='memory'
)
class MailboxTest(TestCase):
def test_set_password(self):
user = User.objects.create_user()
@ -16,6 +24,12 @@ class MailboxTest(TestCase):
mb.set_password('test')
self.assertTrue(sha512_crypt.verify('test', mb.password))
def test___str__(self):
user = User.objects.create_user()
mb = Mailbox.objects.create(username='test', osuser=user)
mb.set_password('test')
self.assertEqual(str(mb), 'test')
class MailAddressTest(TestCase):
def test__str__(self):