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

34 lines
791 B
Python
Raw Normal View History

from django.test import TestCase
2016-01-22 08:23:34 +00:00
import os.path
2016-01-24 19:54:57 +00:00
from . import jobs
from collections import namedtuple
2016-04-05 22:37:37 +01:00
2016-01-22 08:23:34 +00:00
PATH = os.path.dirname(os.path.abspath(__file__))
2016-04-05 22:37:37 +01:00
MockJob = namedtuple('MockJob', {'workspace': {}})
2016-01-24 19:54:57 +00:00
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)