1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
theorangeone.net-legacy/project/common/tests.py
2016-04-05 22:37:37 +01:00

33 lines
791 B
Python

from django.test import TestCase
import os.path
from . import jobs
from collections import namedtuple
PATH = os.path.dirname(os.path.abspath(__file__))
MockJob = namedtuple('MockJob', {'workspace': {}})
class WorkerTestCase(TestCase):
def test_email_error(self):
data = {
'name': 'Person',
'email': '123@123.123',
'message': 'Hi there, things.'
}
workspace = {
'template': 'email/contact_message.html',
'from_email': 'me@123.123',
'to_email': data['email'],
'context': data
}
job = MockJob(workspace)
errors = None
try:
jobs.send_email(job)
except Exception as e:
errors = e
self.assertFalse(errors)