mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-20 09:37:48 +02:00
Fix linting errors
This commit is contained in:
parent
6c43d4c685
commit
432fe3c5e7
@ -617,7 +617,9 @@ def create_object_from_email_message(message, ticket_id, payload, files, logger)
|
|||||||
new = True
|
new = True
|
||||||
else:
|
else:
|
||||||
# Possibly an email with no body but has an attachment
|
# Possibly an email with no body but has an attachment
|
||||||
logger.debug("The QUEUE_EMAIL_BOX_UPDATE_ONLY setting is True so new ticket not created.")
|
logger.debug(
|
||||||
|
"The QUEUE_EMAIL_BOX_UPDATE_ONLY setting is True so new ticket not created."
|
||||||
|
)
|
||||||
return None
|
return None
|
||||||
# Old issue being re-opened
|
# Old issue being re-opened
|
||||||
elif ticket.status == Ticket.CLOSED_STATUS:
|
elif ticket.status == Ticket.CLOSED_STATUS:
|
||||||
|
@ -47,6 +47,14 @@ fake_time = time.time()
|
|||||||
|
|
||||||
|
|
||||||
class GetEmailCommonTests(TestCase):
|
class GetEmailCommonTests(TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
super().tearDownClass()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.queue_public = Queue.objects.create(title="Test", slug="test")
|
self.queue_public = Queue.objects.create(title="Test", slug="test")
|
||||||
self.logger = logging.getLogger("helpdesk")
|
self.logger = logging.getLogger("helpdesk")
|
||||||
@ -484,6 +492,30 @@ class GetEmailCommonTests(TestCase):
|
|||||||
% (email_att_filename),
|
% (email_att_filename),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@override_settings(QUEUE_EMAIL_BOX_UPDATE_ONLY=False)
|
||||||
|
def test_email_for_new_ticket_when_setting_allows_create(self):
|
||||||
|
"""
|
||||||
|
A new ticket is created by email if the QUEUE_EMAIL_BOX_UPDATE_ONLY setting is False
|
||||||
|
"""
|
||||||
|
message, _, _ = utils.generate_text_email(locale="en_GB")
|
||||||
|
ticket = helpdesk.email.extract_email_metadata(
|
||||||
|
message.as_string(), self.queue_public, self.logger
|
||||||
|
)
|
||||||
|
self.assertTrue(ticket is not None, "Ticket not created when it should be.")
|
||||||
|
|
||||||
|
@override_settings(QUEUE_EMAIL_BOX_UPDATE_ONLY=True)
|
||||||
|
def test_email_for_no_new_ticket_when_setting_only_allows_update(self):
|
||||||
|
"""
|
||||||
|
A new ticket cannot be created by email if the QUEUE_EMAIL_BOX_UPDATE_ONLY setting is True
|
||||||
|
"""
|
||||||
|
message, _, _ = utils.generate_text_email(locale="es_ES")
|
||||||
|
ticket = helpdesk.email.extract_email_metadata(
|
||||||
|
message.as_string(), self.queue_public, self.logger
|
||||||
|
)
|
||||||
|
self.assertTrue(
|
||||||
|
ticket is None, f"Ticket was created when it should not be: {ticket}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class EmailTaskTests(TestCase):
|
class EmailTaskTests(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user