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 import TestCase
from django.test.utils import override_settings
from passlib.hash import sha512_crypt from passlib.hash import sha512_crypt
from domains.models import MailDomain from domains.models import MailDomain
from osusers.models import User from osusers.models import User
from managemails.models import ( from managemails.models import (
MailAddress, MailAddress,
Mailbox, Mailbox,
) )
@override_settings(
CELERY_ALWAYS_EAGER=True,
CELERY_CACHE_BACKEND='memory',
BROKER_BACKEND='memory'
)
class MailboxTest(TestCase): class MailboxTest(TestCase):
def test_set_password(self): def test_set_password(self):
user = User.objects.create_user() user = User.objects.create_user()
@ -16,6 +24,12 @@ class MailboxTest(TestCase):
mb.set_password('test') mb.set_password('test')
self.assertTrue(sha512_crypt.verify('test', mb.password)) 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): class MailAddressTest(TestCase):
def test__str__(self): def test__str__(self):