mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2025-01-13 01:19:00 +01:00
fixing style on tests
This commit is contained in:
parent
30e3aa55aa
commit
179ceb2f82
@ -11,6 +11,7 @@ class PublicActionsTestCase(TestCase):
|
||||
- Add a followup
|
||||
- Close resolved case
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Create a queue & ticket we can use for later tests.
|
||||
@ -41,26 +42,26 @@ class PublicActionsTestCase(TestCase):
|
||||
resolution_text = 'Resolved by test script'
|
||||
|
||||
ticket = Ticket.objects.get(id=self.ticket.id)
|
||||
|
||||
|
||||
ticket.status = Ticket.RESOLVED_STATUS
|
||||
ticket.resolution = resolution_text
|
||||
ticket.save()
|
||||
|
||||
current_followups = ticket.followup_set.all().count()
|
||||
|
||||
|
||||
response = self.client.get('%s?ticket=%s&email=%s&close' % (
|
||||
reverse('helpdesk_public_view'),
|
||||
ticket.ticket_for_url,
|
||||
'test.submitter@example.com'))
|
||||
|
||||
|
||||
ticket = Ticket.objects.get(id=self.ticket.id)
|
||||
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertTemplateNotUsed(response, 'helpdesk/public_view_form.html')
|
||||
self.assertEqual(ticket.status, Ticket.CLOSED_STATUS)
|
||||
self.assertEqual(ticket.resolution, resolution_text)
|
||||
self.assertEqual(current_followups+1, ticket.followup_set.all().count())
|
||||
|
||||
self.assertEqual(current_followups + 1, ticket.followup_set.all().count())
|
||||
|
||||
ticket.resolution = old_resolution
|
||||
ticket.status = old_status
|
||||
ticket.save()
|
||||
|
@ -48,12 +48,12 @@ class TicketBasicsTestCase(TestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
post_data = {
|
||||
'title': 'Test ticket title',
|
||||
'queue': self.queue_public.id,
|
||||
'submitter_email': 'ticket1.submitter@example.com',
|
||||
'body': 'Test ticket body',
|
||||
'priority': 3,
|
||||
}
|
||||
'title': 'Test ticket title',
|
||||
'queue': self.queue_public.id,
|
||||
'submitter_email': 'ticket1.submitter@example.com',
|
||||
'body': 'Test ticket body',
|
||||
'priority': 3,
|
||||
}
|
||||
|
||||
response = self.client.post(reverse('helpdesk_home'), post_data, follow=True)
|
||||
last_redirect = response.redirect_chain[-1]
|
||||
@ -67,7 +67,7 @@ class TicketBasicsTestCase(TestCase):
|
||||
self.assertEqual(urlparts.path, reverse('helpdesk_public_view'))
|
||||
|
||||
# Ensure submitter, new-queue + update-queue were all emailed.
|
||||
self.assertEqual(email_count+3, len(mail.outbox))
|
||||
self.assertEqual(email_count + 3, len(mail.outbox))
|
||||
|
||||
def test_create_ticket_private(self):
|
||||
email_count = len(mail.outbox)
|
||||
@ -114,7 +114,7 @@ class TicketBasicsTestCase(TestCase):
|
||||
last_redirect = response.redirect_chain[-1]
|
||||
last_redirect_url = last_redirect[0]
|
||||
# last_redirect_status = last_redirect[1]
|
||||
|
||||
|
||||
# Ensure we landed on the "View" page.
|
||||
# Django 1.9 compatible way of testing this
|
||||
# https://docs.djangoproject.com/en/1.9/releases/1.9/#http-redirects-no-longer-forced-to-absolute-uris
|
||||
@ -122,4 +122,4 @@ class TicketBasicsTestCase(TestCase):
|
||||
self.assertEqual(urlparts.path, reverse('helpdesk_public_view'))
|
||||
|
||||
# Ensure only two e-mails were sent - submitter & updated.
|
||||
self.assertEqual(email_count+2, len(mail.outbox))
|
||||
self.assertEqual(email_count + 2, len(mail.outbox))
|
||||
|
Loading…
Reference in New Issue
Block a user