mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-18 23:56:43 +02:00
Add test for num_to_link function
This commit is contained in:
parent
a42a5b8aeb
commit
9fd170f707
@ -10,6 +10,7 @@ try: # python 3
|
|||||||
except ImportError: # python 2
|
except ImportError: # python 2
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
from helpdesk.templatetags.ticket_to_link import num_to_link
|
||||||
|
|
||||||
class TicketActionsTestCase(TestCase):
|
class TicketActionsTestCase(TestCase):
|
||||||
fixtures = ['emailtemplate.json']
|
fixtures = ['emailtemplate.json']
|
||||||
@ -121,6 +122,26 @@ class TicketActionsTestCase(TestCase):
|
|||||||
}
|
}
|
||||||
response = self.client.post(reverse('helpdesk:update', kwargs={'ticket_id': ticket_id}), post_data, follow=True)
|
response = self.client.post(reverse('helpdesk:update', kwargs={'ticket_id': ticket_id}), post_data, follow=True)
|
||||||
self.assertContains(response, 'Changed Status from Open to Closed')
|
self.assertContains(response, 'Changed Status from Open to Closed')
|
||||||
|
|
||||||
|
def test_num_to_link(self):
|
||||||
|
"""Test that we are correctly expanding links to tickets from IDs"""
|
||||||
|
# make staff user
|
||||||
|
self.loginUser()
|
||||||
|
|
||||||
|
initial_data = {
|
||||||
|
'title': 'Some private ticket',
|
||||||
|
'queue': self.queue_public,
|
||||||
|
'assigned_to': self.user,
|
||||||
|
'status': Ticket.OPEN_STATUS,
|
||||||
|
}
|
||||||
|
|
||||||
|
# create ticket
|
||||||
|
ticket = Ticket.objects.create(**initial_data)
|
||||||
|
ticket_id = ticket.id
|
||||||
|
|
||||||
|
# generate the URL text
|
||||||
|
result = num_to_link('this is ticket#%s' % ticket_id)
|
||||||
|
self.assertEqual(result, "this is ticke <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a>" % (ticket_id, ticket_id))
|
||||||
|
|
||||||
def test_create_ticket_getform(self):
|
def test_create_ticket_getform(self):
|
||||||
self.loginUser()
|
self.loginUser()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user