mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-05-20 01:10:45 +02:00
UPDATED: Renaming methods after reading through the pull request
This commit is contained in:
parent
0c480b4abd
commit
b55eaabebd
@ -124,9 +124,9 @@ def process_queue(q, quiet=False):
|
|||||||
msgSize = msg.split(" ")[1]
|
msgSize = msg.split(" ")[1]
|
||||||
|
|
||||||
full_message = "\n".join(server.retr(msgNum)[1])
|
full_message = "\n".join(server.retr(msgNum)[1])
|
||||||
ticket = object_from_message(message=full_message, queue=q, quiet=quiet)
|
obj = parse_mail_message(message=full_message, queue=q, quiet=quiet)
|
||||||
|
|
||||||
if ticket:
|
if obj:
|
||||||
server.dele(msgNum)
|
server.dele(msgNum)
|
||||||
|
|
||||||
server.quit()
|
server.quit()
|
||||||
@ -147,8 +147,8 @@ def process_queue(q, quiet=False):
|
|||||||
msgnums = data[0].split()
|
msgnums = data[0].split()
|
||||||
for num in msgnums:
|
for num in msgnums:
|
||||||
status, data = server.fetch(num, '(RFC822)')
|
status, data = server.fetch(num, '(RFC822)')
|
||||||
ticket = object_from_message(message=data[0][1], queue=q, quiet=quiet)
|
obj = parse_mail_message(message=data[0][1], queue=q, quiet=quiet)
|
||||||
if ticket:
|
if obj:
|
||||||
server.store(num, '+FLAGS', '\\Deleted')
|
server.store(num, '+FLAGS', '\\Deleted')
|
||||||
|
|
||||||
server.expunge()
|
server.expunge()
|
||||||
@ -362,7 +362,7 @@ def create_object_from_email_message(message, ticket_id, payload, files, quiet):
|
|||||||
return ticket
|
return ticket
|
||||||
|
|
||||||
|
|
||||||
def object_from_message(message, queue, quiet):
|
def parse_mail_message(message, queue, quiet):
|
||||||
# 'message' must be an RFC822 formatted message.
|
# 'message' must be an RFC822 formatted message.
|
||||||
|
|
||||||
msg = message
|
msg = message
|
||||||
|
@ -10,7 +10,7 @@ from django.forms import ValidationError
|
|||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
from helpdesk.management.commands.get_email import object_from_message, create_ticket_cc
|
from helpdesk.management.commands.get_email import parse_mail_message, create_ticket_cc
|
||||||
|
|
||||||
try: # python 3
|
try: # python 3
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
@ -69,7 +69,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
#for m in mail.outbox:
|
#for m in mail.outbox:
|
||||||
# print m.to, m.subject
|
# print m.to, m.subject
|
||||||
|
|
||||||
object_from_message(str(msg), self.queue_public, quiet=True)
|
parse_mail_message(str(msg), self.queue_public, quiet=True)
|
||||||
|
|
||||||
followup = FollowUp.objects.get(message_id=message_id)
|
followup = FollowUp.objects.get(message_id=message_id)
|
||||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||||
@ -99,7 +99,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
|
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
|
|
||||||
object_from_message(str(msg), self.queue_public, quiet=True)
|
parse_mail_message(str(msg), self.queue_public, quiet=True)
|
||||||
|
|
||||||
ticket = Ticket.objects.get(title=self.ticket_data['title'], queue=self.queue_public, submitter_email=submitter_email)
|
ticket = Ticket.objects.get(title=self.ticket_data['title'], queue=self.queue_public, submitter_email=submitter_email)
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
|
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
|
|
||||||
object_from_message(str(msg), self.queue_public, quiet=True)
|
parse_mail_message(str(msg), self.queue_public, quiet=True)
|
||||||
|
|
||||||
followup = FollowUp.objects.get(message_id=message_id)
|
followup = FollowUp.objects.get(message_id=message_id)
|
||||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||||
@ -172,7 +172,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
|
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
|
|
||||||
self.assertRaises(ValidationError, object_from_message, str(msg), self.queue_public, quiet=True)
|
self.assertRaises(ValidationError, parse_mail_message, str(msg), self.queue_public, quiet=True)
|
||||||
|
|
||||||
def test_create_followup_from_email_with_valid_message_id_with_when_no_initial_cc_list(self):
|
def test_create_followup_from_email_with_valid_message_id_with_when_no_initial_cc_list(self):
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
|
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
|
|
||||||
object_from_message(str(msg), self.queue_public, quiet=True)
|
parse_mail_message(str(msg), self.queue_public, quiet=True)
|
||||||
|
|
||||||
followup = FollowUp.objects.get(message_id=message_id)
|
followup = FollowUp.objects.get(message_id=message_id)
|
||||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||||
@ -219,7 +219,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
reply.__setitem__('Content-Type', 'text/plain;')
|
reply.__setitem__('Content-Type', 'text/plain;')
|
||||||
reply.set_payload(self.ticket_data['description'])
|
reply.set_payload(self.ticket_data['description'])
|
||||||
|
|
||||||
object_from_message(str(reply), self.queue_public, quiet=True)
|
parse_mail_message(str(reply), self.queue_public, quiet=True)
|
||||||
|
|
||||||
followup = FollowUp.objects.get(message_id=message_id)
|
followup = FollowUp.objects.get(message_id=message_id)
|
||||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||||
@ -269,7 +269,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
|
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
|
|
||||||
object_from_message(str(msg), self.queue_public, quiet=True)
|
parse_mail_message(str(msg), self.queue_public, quiet=True)
|
||||||
|
|
||||||
followup = FollowUp.objects.get(message_id=message_id)
|
followup = FollowUp.objects.get(message_id=message_id)
|
||||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||||
@ -303,7 +303,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
reply.__setitem__('Content-Type', 'text/plain;')
|
reply.__setitem__('Content-Type', 'text/plain;')
|
||||||
reply.set_payload(self.ticket_data['description'])
|
reply.set_payload(self.ticket_data['description'])
|
||||||
|
|
||||||
object_from_message(str(reply), self.queue_public, quiet=True)
|
parse_mail_message(str(reply), self.queue_public, quiet=True)
|
||||||
|
|
||||||
followup = FollowUp.objects.get(message_id=message_id)
|
followup = FollowUp.objects.get(message_id=message_id)
|
||||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||||
@ -353,7 +353,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
|
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
|
|
||||||
object_from_message(str(msg), self.queue_public, quiet=True)
|
parse_mail_message(str(msg), self.queue_public, quiet=True)
|
||||||
|
|
||||||
followup = FollowUp.objects.get(message_id=message_id)
|
followup = FollowUp.objects.get(message_id=message_id)
|
||||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||||
@ -392,7 +392,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
|
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
|
|
||||||
object_from_message(str(reply), self.queue_public, quiet=True)
|
parse_mail_message(str(reply), self.queue_public, quiet=True)
|
||||||
|
|
||||||
followup = FollowUp.objects.get(message_id=message_id)
|
followup = FollowUp.objects.get(message_id=message_id)
|
||||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||||
|
Loading…
Reference in New Issue
Block a user