mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-19 04:06:23 +02:00
pycodestyle formatting
This commit is contained in:
@@ -51,7 +51,6 @@ class TicketBasicsTestCase(TestCase):
|
||||
self.client = Client()
|
||||
|
||||
def test_create_ticket_instance_from_payload(self):
|
||||
|
||||
"""
|
||||
Ensure that a <Ticket> instance is created whenever an email is sent to a public queue.
|
||||
"""
|
||||
@@ -76,7 +75,8 @@ class TicketBasicsTestCase(TestCase):
|
||||
'priority': 3,
|
||||
}
|
||||
|
||||
response = self.client.post(reverse('helpdesk:home'), post_data, follow=True)
|
||||
response = self.client.post(
|
||||
reverse('helpdesk:home'), post_data, follow=True)
|
||||
last_redirect = response.redirect_chain[-1]
|
||||
last_redirect_url = last_redirect[0]
|
||||
# last_redirect_status = last_redirect[1]
|
||||
@@ -95,7 +95,6 @@ class TicketBasicsTestCase(TestCase):
|
||||
# Follow up is anonymous
|
||||
self.assertIsNone(ticket.followup_set.first().user)
|
||||
|
||||
|
||||
def test_create_ticket_public_with_hidden_fields(self):
|
||||
email_count = len(mail.outbox)
|
||||
|
||||
@@ -110,11 +109,11 @@ class TicketBasicsTestCase(TestCase):
|
||||
'priority': 4,
|
||||
}
|
||||
|
||||
response = self.client.post(reverse('helpdesk:home') + "?_hide_fields_=priority", post_data, follow=True)
|
||||
response = self.client.post(
|
||||
reverse('helpdesk:home') + "?_hide_fields_=priority", post_data, follow=True)
|
||||
ticket = Ticket.objects.last()
|
||||
self.assertEqual(ticket.priority, 4)
|
||||
|
||||
|
||||
def test_create_ticket_authorized(self):
|
||||
email_count = len(mail.outbox)
|
||||
self.client.force_login(self.user)
|
||||
@@ -130,7 +129,8 @@ class TicketBasicsTestCase(TestCase):
|
||||
'priority': 3,
|
||||
}
|
||||
|
||||
response = self.client.post(reverse('helpdesk:home'), post_data, follow=True)
|
||||
response = self.client.post(
|
||||
reverse('helpdesk:home'), post_data, follow=True)
|
||||
last_redirect = response.redirect_chain[-1]
|
||||
last_redirect_url = last_redirect[0]
|
||||
# last_redirect_status = last_redirect[1]
|
||||
@@ -188,7 +188,8 @@ class TicketBasicsTestCase(TestCase):
|
||||
'custom_textfield': 'This is my custom text.',
|
||||
}
|
||||
|
||||
response = self.client.post(reverse('helpdesk:home'), post_data, follow=True)
|
||||
response = self.client.post(
|
||||
reverse('helpdesk:home'), post_data, follow=True)
|
||||
|
||||
custom_field_1.delete()
|
||||
last_redirect = response.redirect_chain[-1]
|
||||
@@ -221,7 +222,8 @@ class TicketBasicsTestCase(TestCase):
|
||||
'priority': 3,
|
||||
}
|
||||
|
||||
response = self.client.post(reverse('helpdesk:home'), post_data, follow=True)
|
||||
response = self.client.post(
|
||||
reverse('helpdesk:home'), post_data, follow=True)
|
||||
last_redirect = response.redirect_chain[-1]
|
||||
last_redirect_url = last_redirect[0]
|
||||
# last_redirect_status = last_redirect[1]
|
||||
@@ -266,7 +268,6 @@ class EmailInteractionsTestCase(TestCase):
|
||||
}
|
||||
|
||||
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>
|
||||
@@ -302,7 +303,6 @@ class EmailInteractionsTestCase(TestCase):
|
||||
self.assertIn(submitter_email, mail.outbox[0].to)
|
||||
|
||||
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.
|
||||
Also, make sure that the RFC 2822 field "message-id" is stored on the <Ticket.submitter_email_id>
|
||||
@@ -322,7 +322,8 @@ class EmailInteractionsTestCase(TestCase):
|
||||
|
||||
object_from_message(str(msg), self.queue_public, logger=logger)
|
||||
|
||||
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)
|
||||
|
||||
self.assertEqual(ticket.ticket_for_url, "mq1-%s" % ticket.id)
|
||||
|
||||
@@ -417,8 +418,10 @@ class EmailInteractionsTestCase(TestCase):
|
||||
# Ensure that the submitter is notified
|
||||
self.assertIn(submitter_email, mail.outbox[0].to)
|
||||
|
||||
# Ensure that the queue's email was not subscribed to the event notifications.
|
||||
self.assertRaises(TicketCC.DoesNotExist, TicketCC.objects.get, ticket=ticket, email=to_list[0])
|
||||
# Ensure that the queue's email was not subscribed to the event
|
||||
# notifications.
|
||||
self.assertRaises(TicketCC.DoesNotExist,
|
||||
TicketCC.objects.get, ticket=ticket, email=to_list[0])
|
||||
|
||||
for cc_email in cc_list:
|
||||
|
||||
@@ -825,14 +828,16 @@ class EmailInteractionsTestCase(TestCase):
|
||||
msg.__setitem__('Message-ID', message_id)
|
||||
msg.__setitem__('Subject', self.ticket_data['title'])
|
||||
msg.__setitem__('From', submitter_email)
|
||||
msg.__setitem__('To', self.queue_public_with_notifications_disabled.email_address)
|
||||
msg.__setitem__(
|
||||
'To', self.queue_public_with_notifications_disabled.email_address)
|
||||
msg.__setitem__('Cc', ','.join(cc_list))
|
||||
msg.__setitem__('Content-Type', 'text/plain;')
|
||||
msg.set_payload(self.ticket_data['description'])
|
||||
|
||||
email_count = len(mail.outbox)
|
||||
|
||||
object_from_message(str(msg), self.queue_public_with_notifications_disabled, logger=logger)
|
||||
object_from_message(
|
||||
str(msg), self.queue_public_with_notifications_disabled, logger=logger)
|
||||
|
||||
followup = FollowUp.objects.get(message_id=message_id)
|
||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||
@@ -954,14 +959,16 @@ class EmailInteractionsTestCase(TestCase):
|
||||
msg.__setitem__('Message-ID', message_id)
|
||||
msg.__setitem__('Subject', self.ticket_data['title'])
|
||||
msg.__setitem__('From', submitter_email)
|
||||
msg.__setitem__('To', self.queue_public_with_notifications_disabled.email_address)
|
||||
msg.__setitem__(
|
||||
'To', self.queue_public_with_notifications_disabled.email_address)
|
||||
msg.__setitem__('Cc', ','.join(cc_list))
|
||||
msg.__setitem__('Content-Type', 'text/plain;')
|
||||
msg.set_payload(self.ticket_data['description'])
|
||||
|
||||
email_count = len(mail.outbox)
|
||||
|
||||
object_from_message(str(msg), self.queue_public_with_notifications_disabled, logger=logger)
|
||||
object_from_message(
|
||||
str(msg), self.queue_public_with_notifications_disabled, logger=logger)
|
||||
|
||||
followup = FollowUp.objects.get(message_id=message_id)
|
||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||
@@ -994,11 +1001,13 @@ class EmailInteractionsTestCase(TestCase):
|
||||
reply.__setitem__('In-Reply-To', message_id)
|
||||
reply.__setitem__('Subject', self.ticket_data['title'])
|
||||
reply.__setitem__('From', submitter_email)
|
||||
reply.__setitem__('To', self.queue_public_with_notifications_disabled.email_address)
|
||||
reply.__setitem__(
|
||||
'To', self.queue_public_with_notifications_disabled.email_address)
|
||||
reply.__setitem__('Content-Type', 'text/plain;')
|
||||
reply.set_payload(self.ticket_data['description'])
|
||||
|
||||
object_from_message(str(reply), self.queue_public_with_notifications_disabled, logger=logger)
|
||||
object_from_message(
|
||||
str(reply), self.queue_public_with_notifications_disabled, logger=logger)
|
||||
|
||||
followup = FollowUp.objects.get(message_id=message_id)
|
||||
ticket = Ticket.objects.get(id=followup.ticket.id)
|
||||
@@ -1093,8 +1102,12 @@ class EmailInteractionsTestCase(TestCase):
|
||||
answer="A KB Item",
|
||||
)
|
||||
self.kbitem1.save()
|
||||
cat_url = reverse('helpdesk:submit') + "?kbitem=1&submitter_email=foo@bar.cz&title=lol"
|
||||
cat_url = reverse('helpdesk:submit') + \
|
||||
"?kbitem=1&submitter_email=foo@bar.cz&title=lol"
|
||||
response = self.client.get(cat_url)
|
||||
self.assertContains(response, '<option value="1" selected>KBItem 1</option>')
|
||||
self.assertContains(response, '<input type="email" name="submitter_email" value="foo@bar.cz" class="form-control form-control" required id="id_submitter_email">')
|
||||
self.assertContains(response, '<input type="text" name="title" value="lol" class="form-control form-control" maxlength="100" required id="id_title">')
|
||||
self.assertContains(
|
||||
response, '<option value="1" selected>KBItem 1</option>')
|
||||
self.assertContains(
|
||||
response, '<input type="email" name="submitter_email" value="foo@bar.cz" class="form-control form-control" required id="id_submitter_email">')
|
||||
self.assertContains(
|
||||
response, '<input type="text" name="title" value="lol" class="form-control form-control" maxlength="100" required id="id_title">')
|
||||
|
Reference in New Issue
Block a user