mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-05-20 09:20:46 +02:00
ADDED: <tests.test_ticket_submisssion.test_create_ticket_from_email_with_message_id> to ensure that the RFC 2822 field "message-id" is stored on the <Ticket.submitter_email_id> field. Backwards-compatible test kept.
This commit is contained in:
parent
e880747a2b
commit
ff0ceefab4
@ -28,13 +28,38 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
|
|
||||||
self.client = Client()
|
self.client = Client()
|
||||||
|
|
||||||
def test_create_ticket_from_email(self):
|
def test_create_ticket_from_email_without_message_id(self):
|
||||||
|
|
||||||
|
"""
|
||||||
|
Ensure that a <Ticket> instance is created whenever an email is sent to a public queue.
|
||||||
|
"""
|
||||||
|
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
ticket_data = dict(queue=self.queue_public, **self.ticket_data)
|
ticket_data = dict(queue=self.queue_public, **self.ticket_data)
|
||||||
ticket = Ticket.objects.create(**ticket_data)
|
ticket = Ticket.objects.create(**ticket_data)
|
||||||
self.assertEqual(ticket.ticket_for_url, "q1-%s" % ticket.id)
|
self.assertEqual(ticket.ticket_for_url, "q1-%s" % ticket.id)
|
||||||
self.assertEqual(email_count, len(mail.outbox))
|
self.assertEqual(email_count, len(mail.outbox))
|
||||||
|
|
||||||
|
def test_create_ticket_from_email_with_message_id(self):
|
||||||
|
|
||||||
|
"""
|
||||||
|
Ensure that a <Ticket> instance is created whenever an email is sent to a public queue.
|
||||||
|
Also, make sure that the RFC 2822 field "message-id" is stored on the <Ticket.submitter_email_id>
|
||||||
|
field.
|
||||||
|
"""
|
||||||
|
|
||||||
|
message_id = uuid.uuid4().hex
|
||||||
|
|
||||||
|
self.ticket_data['rfc_2822_message-id'] = message_id
|
||||||
|
|
||||||
|
email_count = len(mail.outbox)
|
||||||
|
ticket_data = dict(queue=self.queue_public, **self.ticket_data)
|
||||||
|
ticket = Ticket.objects.create(**ticket_data)
|
||||||
|
self.assertEqual(ticket.ticket_for_url, "q1-%s" % ticket.id)
|
||||||
|
self.assertEqual(email_count, len(mail.outbox))
|
||||||
|
self.assertEqual(ticket.submitter_email_id, message_id)
|
||||||
|
|
||||||
|
|
||||||
def test_create_ticket_from_email_with_carbon_copy(self):
|
def test_create_ticket_from_email_with_carbon_copy(self):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user