mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2025-01-27 16:29:15 +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
|
- Add a followup
|
||||||
- Close resolved case
|
- Close resolved case
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Create a queue & ticket we can use for later tests.
|
Create a queue & ticket we can use for later tests.
|
||||||
@ -41,26 +42,26 @@ class PublicActionsTestCase(TestCase):
|
|||||||
resolution_text = 'Resolved by test script'
|
resolution_text = 'Resolved by test script'
|
||||||
|
|
||||||
ticket = Ticket.objects.get(id=self.ticket.id)
|
ticket = Ticket.objects.get(id=self.ticket.id)
|
||||||
|
|
||||||
ticket.status = Ticket.RESOLVED_STATUS
|
ticket.status = Ticket.RESOLVED_STATUS
|
||||||
ticket.resolution = resolution_text
|
ticket.resolution = resolution_text
|
||||||
ticket.save()
|
ticket.save()
|
||||||
|
|
||||||
current_followups = ticket.followup_set.all().count()
|
current_followups = ticket.followup_set.all().count()
|
||||||
|
|
||||||
response = self.client.get('%s?ticket=%s&email=%s&close' % (
|
response = self.client.get('%s?ticket=%s&email=%s&close' % (
|
||||||
reverse('helpdesk_public_view'),
|
reverse('helpdesk_public_view'),
|
||||||
ticket.ticket_for_url,
|
ticket.ticket_for_url,
|
||||||
'test.submitter@example.com'))
|
'test.submitter@example.com'))
|
||||||
|
|
||||||
ticket = Ticket.objects.get(id=self.ticket.id)
|
ticket = Ticket.objects.get(id=self.ticket.id)
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.assertTemplateNotUsed(response, 'helpdesk/public_view_form.html')
|
self.assertTemplateNotUsed(response, 'helpdesk/public_view_form.html')
|
||||||
self.assertEqual(ticket.status, Ticket.CLOSED_STATUS)
|
self.assertEqual(ticket.status, Ticket.CLOSED_STATUS)
|
||||||
self.assertEqual(ticket.resolution, resolution_text)
|
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.resolution = old_resolution
|
||||||
ticket.status = old_status
|
ticket.status = old_status
|
||||||
ticket.save()
|
ticket.save()
|
||||||
|
@ -48,12 +48,12 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
post_data = {
|
post_data = {
|
||||||
'title': 'Test ticket title',
|
'title': 'Test ticket title',
|
||||||
'queue': self.queue_public.id,
|
'queue': self.queue_public.id,
|
||||||
'submitter_email': 'ticket1.submitter@example.com',
|
'submitter_email': 'ticket1.submitter@example.com',
|
||||||
'body': 'Test ticket body',
|
'body': 'Test ticket body',
|
||||||
'priority': 3,
|
'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 = response.redirect_chain[-1]
|
||||||
@ -67,7 +67,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
self.assertEqual(urlparts.path, reverse('helpdesk_public_view'))
|
self.assertEqual(urlparts.path, reverse('helpdesk_public_view'))
|
||||||
|
|
||||||
# Ensure submitter, new-queue + update-queue were all emailed.
|
# 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):
|
def test_create_ticket_private(self):
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
@ -114,7 +114,7 @@ class TicketBasicsTestCase(TestCase):
|
|||||||
last_redirect = response.redirect_chain[-1]
|
last_redirect = response.redirect_chain[-1]
|
||||||
last_redirect_url = last_redirect[0]
|
last_redirect_url = last_redirect[0]
|
||||||
# last_redirect_status = last_redirect[1]
|
# last_redirect_status = last_redirect[1]
|
||||||
|
|
||||||
# Ensure we landed on the "View" page.
|
# Ensure we landed on the "View" page.
|
||||||
# Django 1.9 compatible way of testing this
|
# 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
|
# 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'))
|
self.assertEqual(urlparts.path, reverse('helpdesk_public_view'))
|
||||||
|
|
||||||
# Ensure only two e-mails were sent - submitter & updated.
|
# 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